问题
I am learning Node and working on a existing project which has build script as below:
"build": "npm run clean && ./node_modules/.bin/webpack --env=production --progress --profile --colors --display-optimization-bailout"
I did the npm install
as per the instruction, but the build command gives an error below:
$ npm run build
> npm run clean && ./node_modules/.bin/webpack --env=development --progress --profile --colors --display-optimization-bailout
> rimraf build
'.' is not recognized as an internal or external command,
operable program or batch file.
Any idea on what I could be missing and how I can troubleshoot the problem, I am on windows pc. Thanks!
回答1:
Wrap the path to webpack
in JSON escaped double quotes, i.e. \"...\"
.
For instance:
"build": "npm run clean && \"./node_modules/.bin/webpack\" --env=production --progress --profile --colors --display-optimization-bailout"
^^ ^^
来源:https://stackoverflow.com/questions/61090617/node-js-build-problem-with-an-error-is-not-recognized