node js build problem with an error “'.' is not recognized”

假如想象 提交于 2020-05-09 07:10:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!