npm ERR! Cannot read property 'pause' of undefined
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):
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.
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.
In the build stage I can run Npm install and npm update just fine. 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
{
"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
So Sails.js and the Nodebuildpack/Bluemix aren't playing well with each other.
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. (BTW: macOS)
The error only happens when I update my npm version like this:
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
"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.
And don't forget to always specify your node and npm versions directly, instead of adding tilde
or caret
, this just to be safe. check https://stackoverflow.com/a/22345808/5836034 for more about tilde and caret
you can still check @sai-vennam answer here for more info
So I rolled back the sails version in the package.json file from 0.12 to 0.11 and it deployed fine. So CF PUSH and the newest sails version are not getting along on Bluemix. This was using Node 8.0 and NPM version ^5.0.x
链接地址: http://www.djcxy.com/p/27662.html