在IBM Bluemix上部署Nodejs应用程序时出错

时间:2018-02-18 05:06:13

标签: node.js web-applications deployment cloud ibm-cloud

我正在尝试在IBM Bluemix上部署应用程序,但是我收到了错误。

这是我得到的错误:

prateek@localhost:~/get-started-node> cf push
Pushing from manifest to org prateekagrawal89760@gmail.com / space dev as prateekagrawal89760@gmail.com...
Using manifest file /home/prateek/get-started-node/manifest.yml
Getting app info...
Updating app with these attributes...
name:                GetStartedNode
path:                /home/prateek/get-started-node
disk quota:          1G
health check type:   port
instances:           1
memory:              256M
stack:               cflinuxfs2
routes:
    getstartednode-brave-eland.eu-gb.mybluemix.net

Updating app GetStartedNode...
Mapping routes...
Comparing local files to remote cache...
Packaging files to upload...
Uploading files...
15.35 KiB / 15.35 KiB [=======================================================================================================================================] 100.00% 1s

Waiting for API to complete processing files...

Staging app and tracing logs...
-----> IBM SDK for Node.js Buildpack v3.18-20180206-1137
        Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment

        NPM_CONFIG_LOGLEVEL=error
        NPM_CONFIG_PRODUCTION=true
        NODE_ENV=production
        NODE_MODULES_CACHE=true
-----> Installing binaries
        engines.node (package.json):  6
        engines.npm (package.json):   unspecified (use default)

        Resolving node version 6 via 'node-version-resolver'
        Installing IBM SDK for Node.js (6.12.3) from cache
        Using default npm version: 3.10.10
-----> Restoring cache
        Skipping cache restore (new runtime signature)
-----> Building dependencies
        Installing node modules (package.json)
        npm ERR! Linux 4.4.0-109-generic
        npm ERR! argv "/tmp/app/vendor/node/bin/node" "/tmp/app/vendor/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/app/.npmrc"
        npm ERR! node v6.12.3
        npm ERR! npm  v3.10.10
        npm ERR! code EREADFILE

        npm ERR! Error extracting /home/vcap/.npm/cloudant/1.9.0/package.tgz archive: ENOENT: no such file or directory, open '/home/vcap/.npm/cloudant/1.9.0/package.tgz'
        npm ERR!
        npm ERR! If you need help, you may report this error at:
        npm ERR!     <https://github.com/npm/npm/issues>

        npm ERR! Please include the following file with any support request:
        npm ERR!     /tmp/app/npm-debug.log
-----> Build failed


Failed to compile droplet: Failed to compile droplet: exit status 1
Exit status 223
Staging failed: STG: Exited with status 223
Stopping instance 8470cd8b-064c-4fb3-99a7-89e5e7c36038
Destroying container
Successfully destroyed container
Error staging application: App staging failed in the buildpack compile phase
FAILED

你可以从这里看到完整的应用程序:

https://drive.google.com/open?id=1u88Ypf-bupBjD4ONuFgkyUD1qBBAgciQ

我从这里开始学习本教程https://console.bluemix.net/docs/runtimes/nodejs/getting-started.html#getting-started-tutorial

首先我安装了 Cloud Foundry CLI 6.34.1 。 我使用以下方式登录计算机:

cf login

我按照文档中的说明操作,但仍然遇到错误。这个错误到底是什么以及如何解决?

1 个答案:

答案 0 :(得分:5)

尝试将 cloudant 中的 package.json 版本更改为 "1.7.1" 。它解决了我的问题。您也可以尝试任何较新的版本。

您可以使用 npm view cloudant versions 检查可用版本。