最新消息:20190717 VPS服务器:Vultr新加坡,WordPress主题:大前端D8,统一介绍入口:关于

【已解决】npm run build项目出错:npm ERR! code ELIFECYCLE errno 2

npm crifan 25755浏览 0评论

折腾:

【部分解决】ReactJS中react-mobile-datepicker中input被设置readonly时无法滚动选择日期

期间,对于preact项目,之前

npm run build

都一直正常的,此处突然不正常出错了:

出错了:

        + 1 hidden modules
Child extract-text-webpack-plugin:
       [0] ../~/css-loader/lib/css-base.js 2.26 kB {0} [built]
        + 1 hidden modules
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! ucows-app@6.0.0 build: `cross-env NODE_ENV=production webpack -p –progress`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the ucows-app@6.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/crifan/.npm/_logs/2017-07-22T03_15_05_506Z-debug.log

去看log后:

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘run’, ‘build’ ]
2 info using npm@5.0.0
3 info using node@v8.0.0
4 verbose run-script [ ‘prebuild’, ‘build’, ‘postbuild’ ]
5 info lifecycle ucows-app@6.0.0~prebuild: ucows-app@6.0.0
6 verbose lifecycle ucows-app@6.0.0~prebuild: unsafe-perm in lifecycle true
7 verbose lifecycle ucows-app@6.0.0~prebuild: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/crifan/dev/dev_root/daryun/Projects/奥拓/奶牛云/sourcecode/ucowsapp/ucowsapp/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
8 verbose lifecycle ucows-app@6.0.0~prebuild: CWD: /Users/crifan/dev/dev_root/daryun/Projects/奥拓/奶牛云/sourcecode/ucowsapp/ucowsapp
9 silly lifecycle ucows-app@6.0.0~prebuild: Args: [ ‘-c’, ‘mkdirp build && ncp src/assets build/assets’ ]
10 silly lifecycle ucows-app@6.0.0~prebuild: Returned: code: 0  signal: null
11 info lifecycle ucows-app@6.0.0~build: ucows-app@6.0.0
12 verbose lifecycle ucows-app@6.0.0~build: unsafe-perm in lifecycle true
13 verbose lifecycle ucows-app@6.0.0~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/crifan/dev/dev_root/daryun/Projects/奥拓/奶牛云/sourcecode/ucowsapp/ucowsapp/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
14 verbose lifecycle ucows-app@6.0.0~build: CWD: /Users/crifan/dev/dev_root/daryun/Projects/奥拓/奶牛云/sourcecode/ucowsapp/ucowsapp
15 silly lifecycle ucows-app@6.0.0~build: Args: [ ‘-c’, ‘cross-env NODE_ENV=production webpack -p –progress’ ]
16 silly lifecycle ucows-app@6.0.0~build: Returned: code: 2  signal: null
17 info lifecycle ucows-app@6.0.0~build: Failed to exec build script
18 verbose stack Error: ucows-app@6.0.0 build: `cross-env NODE_ENV=production webpack -p –progress`
18 verbose stack Exit status 2
18 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
18 verbose stack     at emitTwo (events.js:125:13)
18 verbose stack     at EventEmitter.emit (events.js:213:7)
18 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
18 verbose stack     at emitTwo (events.js:125:13)
18 verbose stack     at ChildProcess.emit (events.js:213:7)
18 verbose stack     at maybeClose (internal/child_process.js:887:16)
18 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
19 verbose pkgid ucows-app@6.0.0
20 verbose cwd /Users/crifan/dev/dev_root/daryun/Projects/奥拓/奶牛云/sourcecode/ucowsapp/ucowsapp
21 verbose Darwin 16.6.0
22 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
23 verbose node v8.0.0
24 verbose npm  v5.0.0
25 error code ELIFECYCLE
26 error errno 2
27 error ucows-app@6.0.0 build: `cross-env NODE_ENV=production webpack -p –progress`
27 error Exit status 2
28 error Failed at the ucows-app@6.0.0 build script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 2, true ]

倒是也没说是和上面那个库react-mobile-datepicker有关系

但是还是觉得有影响:

因为还存在一个:

react-mobile-datepicker.min.js

然后也去看了看:

node_modules/react-mobile-datepicker/package.json

  "_id": "react-mobile-datepicker@3.0.4",
  "_inBundle": false,
  "_integrity": "sha1-+eADqoAI4yJr5tnAyjc6qP8fFPM=",
  "_location": "/react-mobile-datepicker",
  "main": "./dist/react-mobile-datepicker.js",
  "minified:main": "dist/react-mobile-datepicker.min.js",
  "name": "react-mobile-datepicker",

-》

估计这么直接修改xxx.js

会导致文件的integrity失效

所以导致npm run build的webpack打包失败

后来,在通过源码npm run build正常执行,生成所需要的

react-mobile-datepicker.js

react-mobile-datepicker.min.js

之后:

【已解决】如何从项目react-mobile-datepicker的js源码编译并发布js库

此preact项目再去:

npm run build

就可以正常执行了

-》说明之前的确是由于破坏了库的完整性导致出错的。

转载请注明:在路上 » 【已解决】npm run build项目出错:npm ERR! code ELIFECYCLE errno 2

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
77 queries in 0.105 seconds, using 18.94MB memory