在 Maven 构建日志中调试 NPM 失败

Debug NPM failures in maven build log

我们使用 Maven 来构建我们的应用程序。后端是 Java,但我们使用 frontend-maven-plugin 来构建网络应用程序。

它在本地运行非常可靠。但是,每晚的 Bamboo 作业经常失败。


build   07-May-2016 23:03:03    [INFO] > phantomjs@1.9.18 install /home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node_modules/phantomjs
build   07-May-2016 23:03:03    [INFO] > node install.js
build   07-May-2016 23:03:03    [INFO] 
build   07-May-2016 23:03:04    [INFO] Downloading http://cnpmjs.org/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
build   07-May-2016 23:03:04    [INFO] Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
build   07-May-2016 23:03:04    [INFO] Receiving...
build   07-May-2016 23:04:06    [ERROR] 
build   07-May-2016 23:04:08    [ERROR] 
build   07-May-2016 23:04:11    [ERROR] 
build   07-May-2016 23:04:18    [ERROR] 
build   07-May-2016 23:06:37    [ERROR] 
build   07-May-2016 23:07:54    [ERROR] 
build   07-May-2016 23:07:59    [ERROR] 
build   07-May-2016 23:09:30    [INFO] 
build   07-May-2016 23:09:30    [INFO] Received 12854K total.
build   07-May-2016 23:09:30    [INFO] Extracting tar contents (via spawned process)
build   07-May-2016 23:09:32    [INFO] Removing /home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node_modules/phantomjs/lib/phantom
build   07-May-2016 23:09:32    [INFO] Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1462687770261/phantomjs-1.9.8-linux-x86_64 -> /home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node_modules/phantomjs/lib/phantom
build   07-May-2016 23:09:32    [INFO] Writing location.js file
build   07-May-2016 23:09:32    [INFO] Done. Phantomjs binary available at /home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node_modules/phantomjs/lib/phantom/bin/phantomjs
build   07-May-2016 23:09:32    [ERROR] npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
build   07-May-2016 23:09:32    [ERROR] npm ERR! Linux 4.4.5-15.26.amzn1.x86_64
build   07-May-2016 23:09:32    [ERROR] npm ERR! argv "/home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node/node" "/home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node/node_modules/npm/bin/npm-cli.js" "install"
build   07-May-2016 23:09:32    [ERROR] npm ERR! node v4.3.1
build   07-May-2016 23:09:32    [ERROR] npm ERR! npm  v2.14.12
build   07-May-2016 23:09:32    [ERROR] npm ERR! code ECONNRESET
build   07-May-2016 23:09:32    [ERROR] npm ERR! errno ECONNRESET
build   07-May-2016 23:09:32    [ERROR] npm ERR! syscall read
build   07-May-2016 23:09:32    [ERROR] npm ERR! network read ECONNRESET
build   07-May-2016 23:09:32    [ERROR] npm ERR! network This is most likely not a problem with npm itself
build   07-May-2016 23:09:32    [ERROR] npm ERR! network and is related to network connectivity.
build   07-May-2016 23:09:32    [ERROR] npm ERR! network In most cases you are behind a proxy or have bad network settings.
build   07-May-2016 23:09:32    [ERROR] npm ERR! network 
build   07-May-2016 23:09:32    [ERROR] npm ERR! network If you are behind a proxy, please make sure that the
build   07-May-2016 23:09:32    [ERROR] npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

我们不在代理、防火墙或类似的东西后面。如果我们是,失败将更容易重复。

我问了一个同事。他说当 npm 运行模块的安装脚本时,脚本会尝试从整个网络下载东西。如果脚本中的站点不可用,则失败。

我想验证一下。我无权访问 npm-debug.log 因为 Bamboo 不保留它。我如何弄清楚到底发生了什么?


昨晚,它似乎在尝试安装 which npm 模块时窒息了,它是 phantomjs:

的依赖项
build   07-May-2016 23:09:34    [INFO] phantomjs@1.9.18 node_modules/phantomjs
build   07-May-2016 23:09:34    [INFO] ├── progress@1.1.8
build   07-May-2016 23:09:34    [INFO] ├── kew@0.4.0
build   07-May-2016 23:09:34    [ERROR] npm ERR! argv "/home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node/node" "/home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/node/node_modules/npm/bin/npm-cli.js" "install"
build   07-May-2016 23:09:34    [INFO] ├── request-progress@0.3.1 (throttleit@0.0.2)
build   07-May-2016 23:09:34    [INFO] ├── adm-zip@0.4.4
build   07-May-2016 23:09:34    [INFO] ├── request@2.42.0 (forever-agent@0.5.2, aws-sign2@0.5.0, tunnel-agent@0.4.3, caseless@0.6.0, oauth-sign@0.4.0, stringstream@0.0.5, json-stringify-safe@5.0.1, tough-cookie@2.2.2, mime-types@1.0.2, qs@1.2.2, node-uuid@1.4.7, http-signature@0.10.1, form-data@0.1.4, bl@0.9.5, hawk@1.1.1)
build   07-May-2016 23:09:34    [INFO] ├── npmconf@2.1.1 (ini@1.3.4, uid-number@0.0.5, inherits@2.0.1, once@1.3.3, semver@4.3.6, osenv@0.1.3, nopt@3.0.6, config-chain@1.1.10, mkdirp@0.5.1)
build   07-May-2016 23:09:34    [INFO] └── fs-extra@0.23.1 (path-is-absolute@1.0.0, graceful-fs@4.1.4, jsonfile@2.3.0, rimraf@2.5.2)
build   07-May-2016 23:09:34    [ERROR] npm ERR! node v4.3.1
build   07-May-2016 23:09:34    [ERROR] npm ERR! npm  v2.14.12
build   07-May-2016 23:09:34    [ERROR] 
build   07-May-2016 23:09:34    [ERROR] npm ERR! Callback called more than once.
build   07-May-2016 23:09:34    [ERROR] npm ERR! 
build   07-May-2016 23:09:34    [ERROR] npm ERR! If you need help, you may report this error at:
build   07-May-2016 23:09:34    [ERROR] npm ERR!     <https://github.com/npm/npm/issues>
build   07-May-2016 23:09:34    [ERROR] 
build   07-May-2016 23:09:34    [ERROR] npm ERR! Please include the following file with any support request:
build   07-May-2016 23:09:34    [ERROR] npm ERR!     /home/bamboo/bamboo-agent-home/xml-data/build-dir/DDF-NGHT-JOB1/ddf/catalog/ui/search-ui/standard/npm-debug.log

已对节点 >=4.4 >=5.4 和 >=6 进行修复,它解决了 ECONNRESET 问题。尝试将您的节点升级到上述版本。

有关详细信息,请参阅 here