node js构建问题,错误为“'。”无法识别”

问题描述 投票:1回答:1

我正在学习Node并正在研究具有以下构建脚本的现有项目:

"build": "npm run clean && ./node_modules/.bin/webpack --env=production --progress --profile --colors --display-optimization-bailout"

我按照指令执行了npm install,但是build命令在下面给出了一个错误:

$ 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.

关于在Windows PC上可能丢失的内容以及如何解决该问题的任何想法。谢谢!

node.js npm-scripts
1个回答
1
投票

将JSON中的webpack路径转义为双引号,即\"...\"

例如:

"build": "npm run clean && \"./node_modules/.bin/webpack\" --env=production --progress --profile --colors --display-optimization-bailout"
                           ^^                           ^^
© www.soinside.com 2019 - 2024. All rights reserved.