我正在尝试将Sails.js应用程序部署到Bluemix,在Bluemix上的工具链的部署阶段(当调用CF PUSH命令时),我们收到以下错误:
npm错误!无法读取未定义的属性'pause‘
我知道跟踪指向npm-error.log文件,但是,我无法访问它,因为我们无法通过ssh查看文件中的内容,因为应用程序在部署失败后处于“关闭”状态。
同样的代码在8天前通过Cf push {app name}和Bluemix中的一个简单的构建和部署工具链成功部署。
在构建阶段,我可以很好地运行Npm install和npm update。然而,它似乎在部署阶段又这样做了,而且失败了。以下是有关此故障的一些详细信息
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 containerPackage.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": ""
}到目前为止我试过的东西。-change节点版本-changed npm版本-change依赖项版本要包括^前缀的-removed package.json文件中的所有依赖项和所有依赖项
因此,Sails.js和Nodebuildpack/Bluemix并不能很好地配合。
任何帮助都将不胜感激。谢谢
发布于 2017-09-10 17:06:21
这也同样发生在我身上。我必须回滚npm的前一个版本: 5.3.0,它现在可以工作了。(顺便说一句: macOS)
只有当我像这样更新我的npm版本时,才会发生错误:
Update available 5.3.0 → 5.4.1
Run npm i -g npm to update 发布于 2017-09-11 22:04:53
处理它的最好方法是将package.json更新为使用engines,如下所示
"description": "a Sails application",
"keywords": [],
"engines": {
"node": "6.10.1",
"npm": "5.3.0"
},在尝试推送到似乎是由@m-t指定的npm版本的heroku时遇到了这个问题,并且指定了类似上面的版本会使ibm bluemix选择它作为默认节点引擎,而不是使用最新的稳定版本。
,不要忘记总是直接指定节点和npm版本,而不是添加
tilde或caret,这只是为了安全。有关tilde and caret的更多信息,请查看https://stackoverflow.com/a/22345808/5836034
您仍可查看@sai-vennam answer here了解更多信息
发布于 2017-09-11 22:25:55
因此,我将package.json文件中的sails版本从0.12回滚到0.11,它部署得很好。所以CF推送和最新的sails版本在Bluemix上不能很好地相处。这使用的是Node 8.0和NPM版本^5.0.x
https://stackoverflow.com/questions/46133316
复制相似问题