[英]npm ERR! Cannot read property 'pause' of undefined --Bluemix
I am trying to deploy a Sails.js app to Bluemix and we are getting the following error during the deploy stage in the toolchain on Bluemix (When the CF PUSH command is called): 我正在尝试将Sails.js应用程序部署到Bluemix,并且在Bluemix上的工具链中的部署阶段(调用CF PUSH命令时)遇到以下错误:
npm ERR! npm ERR! Cannot read property 'pause' of undefined 无法读取未定义的属性“暂停”
I understand the trace goes to the npm-error.log file, however, I haven't been able to get to it as we cannot ssh in to see whats in the file as the application is in its "off" state after a bad deploy. 我知道跟踪信息会转到npm-error.log文件,但是由于无法通过ssh来查看文件中的内容,所以我无法获取该文件,因为应用程序在发生错误后处于“关闭”状态部署。
This same code was successfully deployed with both Cf push {app name}} and through a simple build and deploy toolchain in Bluemix just 8 days ago. 仅在8天前,通过Cf push {app name}}以及通过简单的构建和部署工具链就已经成功部署了相同的代码。
In the build stage I can run Npm install and npm update just fine. 在构建阶段,我可以运行Npm install和npm update。 However, it seems to do this again in the deploy stage regardless and it fails. 但是,无论如何,它似乎都会在部署阶段再次执行此操作,并且失败了。 Here is some detail on this failure 这是有关此失败的一些详细信息
NODE_ENV=production
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
Visit http://docs.cloudfoundry.org/buildpacks/node/index.html#vendoring
NODE_HOME=/tmp/app/.cloudfoundry/0/node
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
Restoring cache
Loading 3 from cacheDirectories (default):
- .npm
- .cache/yarn (not cached - skipping)
- bower_components (not cached - skipping)
Installing node modules (package.json) Building dependencies
sails@0.12.13 preinstall /tmp/app/node_modules/sails
node ./lib/preinstall_npmcheck.js
Sails.js Installation: Checking npm-version successful
npm ERR! Cannot read property 'pause' of undefined
npm ERR! /tmp/app/.npm/_logs/2017-09-09T17_02_48_660Z-debug.log
**ERROR** Unable to build dependencies: exit status 1
Failed to compile droplet
Exit status 223
Staging failed: Exited with status 223
Destroying container
npm ERR! A complete log of this run can be found in:
Successfully destroyed container
Package.json file Package.json文件
{
"name": "myApp",
"private": true,
"version": "0.0.1",
"description": "Stuff my app does",
"keywords": [
"Cool Apps"
],
"dependencies": {
"bcryptjs": "^2.4.3",
"cacheman": "^2.2.1",
"ejs": "2.3.4",
"elasticsearch": "^13.0.0-rc2",
"find-remove": "^1.0.1",
"fs": "0.0.1-security",
"grunt": "1.0.1",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-coffee": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-contrib-copy": "1.0.0",
"grunt-contrib-cssmin": "1.0.1",
"grunt-contrib-jst": "1.0.0",
"grunt-contrib-less": "1.3.0",
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-sails-linker": "~0.10.1",
"grunt-sync": "0.5.2",
"include-all": "^1.0.0",
"jsonwebtoken": "^7.3.0",
"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"passport": "^0.2.x",
"passport-http-bearer": "^1.0.1",
"passport-idaas-openidconnect": "^1.1.0",
"passport-local": "^1.0.0",
"rc": "1.0.1",
"request": "^2.81.0",
"request-promise": "^4.2.0",
"sails": "~0.12.13",
"sails-disk": "~0.10.9",
"sails-mongo": "^0.12.2",
"stream": "0.0.2",
"uuid-1345": "^0.99.6",
"validator": "^7.0.0",
"natural-sort": "^1.0.0"
},
"scripts": {
"start": "node app.js"
},
"engines": {
"node": "^8.0.x",
"npm": "^5.0.x"
},
"main": "app.js",
"author": "Scott N",
"license": ""
}
Things I've tried so far. 到目前为止我尝试过的事情。 -change node versions -changed npm versions -change dependencies versions to include the ^ prefix -removed all dependencies but Sails in the package.json file -更改节点版本-更改npm版本-更改依赖项版本以包含^前缀-删除了package.json文件中除Sails之外的所有依赖项
So Sails.js and the Nodebuildpack/Bluemix aren't playing well with each other. 因此,Sails.js和Nodebuildpack / Bluemix的配合不好。
Any help would be appreciated. 任何帮助,将不胜感激。 Thank you 谢谢
It happens to me just the same. 我也是一样 and I've to roll back the prev version of npm: 5.3.0 and it's working now. 而且我必须回退npm的先前版本:5.3.0,并且现在可以正常工作。 (BTW: macOS) (顺便说一句:macOS)
The error only happens when I update my npm version like this: 仅当我这样更新我的npm版本时,才会发生错误:
Update available 5.3.0 → 5.4.1
Run npm i -g npm to update
The best way to handle it is to update your package.json
to use engines
like so 处理它的最好方法是更新package.json
以使用像这样的engines
"description": "a Sails application",
"keywords": [],
"engines": {
"node": "6.10.1",
"npm": "5.3.0"
},
Got this issue while trying to push to heroku
which seems to be the npm version specified by @mt , and also specifying the versions like above makes ibm bluemix pick it up as default node engine instead of using the latest stable version. 得到了这个问题,而试图推到heroku
,这似乎是由指定的NPM版本@mt ,并指定版本像上面让IBM bluemix把它捡起来作为默认节点引擎而是采用了最新的稳定版本的。
And don't forget to always specify your node and npm versions directly, instead of adding
tilde
orcaret
, this just to be safe. 并且不要忘记总是直接指定您的节点和npm版本,而不是添加tilde
或caret
,这只是为了安全。 check https://stackoverflow.com/a/22345808/5836034 for more abouttilde and caret
检查https://stackoverflow.com/a/22345808/5836034了解有关tilde and caret
更多信息
you can still check @sai-vennam answer here for more info 您仍然可以在此处查看@ sai-vennam答案以获取更多信息
So I rolled back the sails version in the package.json file from 0.12 to 0.11 and it deployed fine. 因此,我将package.json文件中的sails版本从0.12回滚到了0.11,并进行了很好的部署。 So CF PUSH and the newest sails version are not getting along on Bluemix. 因此,CF PUSH和最新的Sails版本在Bluemix上并不相处。 This was using Node 8.0 and NPM version ^5.0.x 这使用的是Node 8.0和NPM版本^ 5.0.x
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.