突然间,构建脚本开始失败。环境没有变化,也没有倾诉。在dev中工作很好,在prod中失败。
dev和prod (均为Ubuntus):
$ npm -v
5.3.0
$ node -v
v6.11.2单位:
oleg@DevVM ~/Code/loaded.bike/assets $ npm run deploy
> @ deploy /home/oleg/Code/loaded.bike/assets
> brunch build --production
17:49:59 - info: compiling
17:49:59 - info: compiled 19 files into 2 files, copied 32 in 6.9 sec在prod:
deploy@loaded-bike-app:~/builds/assets$ npm run deploy
> @ deploy /home/deploy/builds/assets
> brunch build --production
00:45:30 - error: Initialization error - Could not load global module 'jquery'. Possible solution: add 'jquery' to package.json and `npm install`. Could not load global module 'jquery'. Possible solution: add 'jquery' to package.json and `npm install`.
Stack trace was suppressed. Run with `LOGGY_STACKS=1` to see the trace.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ deploy: `brunch build --production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ deploy 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! /home/deploy/.npm/_logs/2017-08-12T00_45_30_084Z-debug.log全日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using npm@5.3.0
3 info using node@v6.11.2
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle @~predeploy: @
6 info lifecycle @~deploy: @
7 verbose lifecycle @~deploy: unsafe-perm in lifecycle true
8 verbose lifecycle @~deploy: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/deploy/builds/assets/node_modules/.bin:/home/deploy/bin:/home/deploy/.local
/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle @~deploy: CWD: /home/deploy/builds/assets
10 silly lifecycle @~deploy: Args: [ '-c', 'brunch build --production' ]
11 silly lifecycle @~deploy: Returned: code: 1 signal: null
12 info lifecycle @~deploy: Failed to exec deploy script
13 verbose stack Error: @ deploy: `brunch build --production`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:891:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid @
15 verbose cwd /home/deploy/builds/assets
16 verbose Linux 4.8.0-41-generic
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
18 verbose node v6.11.2
19 verbose npm v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error @ deploy: `brunch build --production`
22 error Exit status 1
23 error Failed at the @ deploy script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]将jquery、tether添加到package.json中可以修复require错误,但它只会限制sass编译。这只是JS误触发异步函数,还是这里发生了什么?又一次,它突然完全失败了。昨天和今天部署得很好,如果失败了,我什么也不改变。有什么线索吗?
编辑:
package.json:
{
"repository": {},
"license": "MIT",
"scripts": {
"deploy": "brunch build --production",
"watch": "brunch watch --stdin"
},
"dependencies": {
"bootstrap": "^4.0.0-alpha.6",
"phoenix": "file:../deps/phoenix",
"phoenix_html": "file:../deps/phoenix_html"
},
"devDependencies": {
"babel-brunch": "6.0.6",
"brunch": "2.10.10",
"clean-css-brunch": "2.10.0",
"css-brunch": "2.10.0",
"sass-brunch": "2.10.4",
"uglify-js-brunch": "2.1.1"
}
}实际上,我在prod上看到了这些垃圾(但没有在dev上看到)
npm ERR! peer dep missing: jquery@>=3.0.0, required by bootstrap@4.0.0-beta
npm ERR! peer dep missing: popper.js@^1.11.0, required by bootstrap@4.0.0-beta那是怎么回事?引导程序将这些定义为它自己的package.json中的依赖项(而不是package.json)。npm现在没有引入依赖关系吗?
发布于 2017-08-12 04:26:58
"bootstrap": "^4.0.0-alpha.6"需要锁定版本。昨天,引导程序从字母6转到了测试版。把一切都搞砸了。不知道为什么只在一台机器上开始故障(即使是在npm cache clear之后)。Sass编译在beta版下失败,所以我现在将它锁定为字母6。
我认为我需要开始锁定依赖版本。这花了很长时间才弄明白。
https://stackoverflow.com/questions/45645546
复制相似问题