Npm run build reported an error.

  node.js, question

debug

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_global\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@3.10.2
3 info using node@v4.4.7
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle vue-fast@1.0.0~prebuild: vue-fast@1.0.0
6 silly lifecycle vue-fast@1.0.0~prebuild: no script for prebuild, continuing
7 info lifecycle vue-fast@1.0.0~build: vue-fast@1.0.0
8 verbose lifecycle vue-fast@1.0.0~build: unsafe-perm in lifecycle true
9 verbose lifecycle vue-fast@1.0.0~build: PATH: C:\Program Files\nodejs\node_global\node_modules\npm\bin\node-gyp-bin;Z:\minqing\static\pyyx\app\h5\node_modules\.bin;C:\Program Files\nodejs;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;C:\Program Files (x86)\less;C:\Users\yx027\AppData\Roaming\npm
10 verbose lifecycle vue-fast@1.0.0~build: CWD: Z:\minqing\static\pyyx\app\h5
11 silly lifecycle vue-fast@1.0.0~build: Args: [ '/d /s /c',
11 silly lifecycle   'export NODE_ENV=production && webpack --progress --hide-modules' ]
12 silly lifecycle vue-fast@1.0.0~build: Returned: code: 1  signal: null
13 info lifecycle vue-fast@1.0.0~build: Failed to exec build script
14 verbose stack Error: vue-fast@1.0.0 build: `export NODE_ENV=production && webpack --progress --hide-modules`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_global\node_modules\npm\lib\utils\lifecycle.js:242:16)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at EventEmitter.emit (events.js:172:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_global\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at ChildProcess.emit (events.js:172:7)
14 verbose stack     at maybeClose (internal/child_process.js:827:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid vue-fast@1.0.0
16 verbose cwd Z:\minqing\static\pyyx\app\h5
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_global\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
19 error node v4.4.7
20 error npm  v3.10.2
21 error code ELIFECYCLE
22 error vue-fast@1.0.0 build: `export NODE_ENV=production && webpack --progress --hide-modules`
22 error Exit status 1
23 error Failed at the vue-fast@1.0.0 build script 'export NODE_ENV=production && webpack --progress --hide-modules'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the vue-fast package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     export NODE_ENV=production && webpack --progress --hide-modules
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs vue-fast
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls vue-fast
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

package

{
  "name": "vue-fast",
  "version": "1.0.0",
  "description": "quick build vue",
  "main": "bundle.js",
  "scripts": {
    "dev": "export NODE_ENV=development && webpack-dev-server --host=127.0.0.1 --port 7777 --inline --hot --quiet",
    "build": "export NODE_ENV=production && webpack --progress --hide-modules"
  },
  "author": "oct16",
  "license": "MIT",
  "devDependencies": {
    "babel": "^6.5.2",
    "babel-loader": "^6.2.3",
    "babel-plugin-transform-runtime": "^6.5.2",
    "babel-preset-es2015": "^6.5.0",
    "babel-preset-stage-0": "^6.5.0",
    "babel-runtime": "^6.5.0",
    "css-loader": "^0.23.1",
    "extract-text-webpack-plugin": "^1.0.1",
    "less": "^2.7.1",
    "less-loader": "^2.2.3",
    "style-loader": "^0.13.1",
    "vue": "^1.0.24",
    "vue-hot-reload-api": "^1.3.2",
    "vue-html-loader": "^1.2.2",
    "vue-loader": "^8.5.2",
    "vue-resource": "^0.7.4",
    "vue-router": "^0.7.13",
    "vue-style-loader": "^1.0.0",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.14.1"
  }
}
"export NODE_ENV=production && webpack --progress --hide-modules"

This is the way to set environment variables under linux. It seems that the author has given up on windows and has to endure the pain of being rejected from time to time when developing under windows.

I have not used windows for a long time, but I probably remember how to set environment variables. You put all theexportChange tosetTry it.


Or reference@wusisuUsing a linux-like terminal