vue.js - npm run build 报错

查看:895
本文介绍了vue.js - npm run build 报错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

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"

这是 linux 下设置环境变量的方法。看来作者已经不管 windows 了,在 windows 下开发就要时不时忍受被人嫌弃的痛苦。

早不用 windows 了,不过大概还记得设置环境变量的方法。你把所有的 export 改成 set 试试。


或者参考 @wusisu ,使用一个类 linux 的终端

这篇关于vue.js - npm run build 报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆