无法写入文件:ENOENT:没有此类文件或目录

时间:2017-09-19 07:37:35

标签: cygwin npm javascript

我正在尝试构建一个名为build的文件夹,它将包含许多地图文件和JavaScript文件。但我得到的问题如下所示。

代码:

"scripts": {
    "prestart": "d2-manifest package.json manifest.webapp",
    "start": "webpack-dev-server",
    "test": "echo Everything probably works great\\! ## karma start test/config/karma.config.js --single-run true",
    "build": "rm -rf build && set NODE_ENV=production webpack --progress && npm run manifest",
    "postbuild": "cp -r src/i18n icon.png ./build/",
    "validate": "npm ls --depth 0",
    "manifest": "d2-manifest package.json build/manifest.webapp",
    "deploy": "npm run build && mvn clean deploy",
    "lint": "echo Looks good."
  }

错误:

Error in cygwin "Failed to write to file: ENOENT: no such file or directory"

1 个答案:

答案 0 :(得分:0)

(我忽略了你似乎在Windows机器上运行它的事实)

set命令没有按照您的想法执行。要为命令设置环境变量,请使用

VARIABLE=value cmd

env VARIABLE=value cmd

这意味着要改变

set NODE_ENV=production webpack --progress

env NODE_ENV=production webpack --progress

使用set NODE_ENV=production webpack --progress,您只需将当前shell实例的位置参数设置为NODE_ENV=productionwebpack--progress