hcengineering/platform · error · Error
Invalid package specifier: ${rawPackageSpecifier}
Error message
Invalid package specifier: ${rawPackageSpecifier} What it means
_parsePackageSpecifier splits a raw specifier like 'name@version' into package name and version. If the name portion comes out empty — e.g. the specifier starts with '@' without a scoped name, or is empty — it throws this error naming the offending raw specifier.
Source
Thrown at foundations/core/common/scripts/install-run.js:366
function _parsePackageSpecifier(rawPackageSpecifier) {
rawPackageSpecifier = (rawPackageSpecifier || '').trim();
const separatorIndex = rawPackageSpecifier.lastIndexOf('@');
let name;
let version = undefined;
if (separatorIndex === 0) {
// The specifier starts with a scope and doesn't have a version specified
name = rawPackageSpecifier;
}
else if (separatorIndex === -1) {
// The specifier doesn't have a version
name = rawPackageSpecifier;
}
else {
name = rawPackageSpecifier.substring(0, separatorIndex);
version = rawPackageSpecifier.substring(separatorIndex + 1);
}
if (!name) {
throw new Error(`Invalid package specifier: ${rawPackageSpecifier}`);
}
return { name, version };
}
let _npmPath = undefined;
/**
* Get the absolute path to the npm executable
*/
function getNpmPath() {
if (!_npmPath) {
try {
if (_isWindows()) {
// We're on Windows
const whereOutput = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('where npm', { stdio: [] }).toString();
const lines = whereOutput.split(os__WEBPACK_IMPORTED_MODULE_2__.EOL).filter((line) => !!line);
// take the last result, we are looking for a .cmd command
// see https://github.com/microsoft/rushstack/issues/759
_npmPath = lines[lines.length - 1];
}View on GitHub (pinned to 63e28dc964)
Solutions
- Pass a complete specifier: rush@5.100.1 or @microsoft/rush@5.100.1
- Ensure the '@' separator is followed by an actual package name
- Quote the argument in your shell so it isn't expanded or split
Example fix
// before node install-run-rush.js @ build // after node install-run-rush.js @microsoft/rush@5.100.1 build
Defensive patterns
Strategy: validation
Validate before calling
const spec = process.argv[2] ?? '';
if (!spec || !/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(@.+)?$/.test(spec)) throw new Error(`Malformed package specifier: ${spec}`); Try / catch
try { parseSpecifier(raw); }
catch (e) { if (/Invalid package specifier/.test(e.message)) { console.error('Use <name> or <name>@<version>, e.g. rush@5.100.1'); } else throw e; } Prevention
- Quote specifiers in the shell to prevent '@' expansion issues
- Copy full specifiers including name and version
- Validate CLI args in wrapper scripts before delegating
When it happens
Trigger: Calling the script with a package specifier argument that is empty, or like '@' / '@@version' / '@/' such that parsing yields an empty name.
Common situations: Typo in the install-run-rush.js command line (dangling '@' with no package name); shell expansion swallowing the package name; copy-pasting a partial specifier.
Related errors
- Invalid package specifier: ${rawPackageSpecifier}
- Unable to determine the required version of Rush from ${RUSH
- Failed to parse response for part ${partNumber}
- Invalid endpoint reference
- Invalid storage config:${st}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/9bd0b8b0499fbf46.
Report an issue: GitHub.