brunch build --production 仅在生产中失败
brunch build --production fails only in production
构建脚本突然开始失败。环境或配置完全没有变化。在开发中工作正常,在生产中失败。
dev 和 prod(都是 Ubuntu):
$ 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
在产品中:
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"
}
}
我实际上在产品上看到了这些废话(但在开发上没有)
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
那是什么? Bootstrap 在它自己的 package.json 中将它们定义为依赖项(不是 peerDependency)。 npm 现在不引入依赖项?
"bootstrap": "^4.0.0-alpha.6"
需要锁定版本。 Bootstrap 昨天从 alpha.6 升级到 beta。把一切都搞砸了。不知道为什么只在一台机器上开始失败(甚至在 npm cache clear
之后)。 Sass 在 beta 下编译失败,所以我暂时将它锁定为 alpha.6。
我想我需要开始锁定依赖版本。这花了太长时间才弄明白。
构建脚本突然开始失败。环境或配置完全没有变化。在开发中工作正常,在生产中失败。
dev 和 prod(都是 Ubuntu):
$ 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
在产品中:
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"
}
}
我实际上在产品上看到了这些废话(但在开发上没有)
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
那是什么? Bootstrap 在它自己的 package.json 中将它们定义为依赖项(不是 peerDependency)。 npm 现在不引入依赖项?
"bootstrap": "^4.0.0-alpha.6"
需要锁定版本。 Bootstrap 昨天从 alpha.6 升级到 beta。把一切都搞砸了。不知道为什么只在一台机器上开始失败(甚至在 npm cache clear
之后)。 Sass 在 beta 下编译失败,所以我暂时将它锁定为 alpha.6。
我想我需要开始锁定依赖版本。这花了太长时间才弄明白。