【问题标题】:node js build problem with an error "'.' is not recognized"节点 js 构建问题,出现错误“'。'不被识别”
【发布时间】:2020-04-07 22:46:49
【问题描述】:

我正在学习 Node 并在一个现有项目中工作,该项目的构建脚本如下:

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

我按照说明执行了npm install,但构建命令给出了以下错误:

$ 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】:

    webpack 的路径用JSON 转义双引号括起来,即\"...\"

    例如:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-22
      • 2017-04-17
      • 1970-01-01
      • 1970-01-01
      • 2013-03-07
      • 2023-03-20
      • 1970-01-01
      相关资源
      最近更新 更多