VSO
VSO

Reputation: 12666

NPM Failing on Trying to Find Shell Script

Console output on npm run build failure:

'.' is not recognized as an internal or external command, operable program or batch file.

And the relevant npm file:

"scripts": {
    "postinstall": "jspm install && npm run build",
    "start": "http-server",
    "build": "./bin/build-code",
    "build-home": "./bin/build-home -dw",
    "build-common-deps": "./bin/build-common-deps -dw",
    "build-navbar": "./bin/build-navbar -dw",
    "build-root": "./bin/build-root -dw",
    "build-angular1": "./bin/build-angular1 -dw",
    "build-react": "./bin/build-react -w",
    "build-preact": "./bin/build-preact -dw",
    "build-vanilla": "./bin/build-vanillajs",
    "build-angular2": "./bin/build-angular2 -dw"
}

Looks like it's not understanding the pathing to the ./bin/build-code script location. From what I understand, it looks for files from the package.json's location? So, if the app has a bin folder in the same dir as package.json, then this is the correct pathing to the build-code script, which is within the bin folder. What gives? Using PowerShell to run npm run build if it matters.

P.S. I tried with basic Command Prompt - no changes. Someone running the same build (both of us just pulled from repo) on Cygwin said they had to "Change dos endings to unix", which doesn't tell me much and doesn't seem to be the issue.

Upvotes: 0

Views: 34

Answers (1)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200523

Looks to me like npm is invoking batch scripts. Batch files are run in CMD.exe (even when invoked from PowerShell), which doesn't recognize / as a path separator. That's where the error message comes from.

Replace the forward slashes with \ (or \\ if they require escaping).

Upvotes: 1

Related Questions