Reputation: 83
I have npm scripts that run webpack
"scripts": {
"build": "webpack --display-error-details --progress --config webpack.dev.config.js",
"build:prod": "webpack --display-error-details --config webpack.prod.config.js",
}
Webpack installs fine and I can see the symlink in node_modules/.bin
Locally I can do an npm run build and it works, however on the production server it fails with:
/bin/sh: 1: webpack: not found
I can run node_modules/.bin/webpack and everything works.
Output of npm config ls looks nearly identical local vs server (same npm and node versions)
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.4.1 node/v8.10.0 linux x64"
; userconfig /home/ubuntu/.npmrc
script-shell = "/bin/sh"
; builtin config undefined
globalconfig = "/etc/npmrc"
globalignorefile = "/etc/npmignore"
prefix = "/usr/local"
; node bin location = /usr/bin/node
What am I missing here?
Upvotes: 3
Views: 696
Reputation: 83
At the end of the day, it was because npm run doesn't work in directories containing a colon, because $PATH is delimited with colons.
Upvotes: 3