IBM Cloud - Node.js 应用程序不会部署 - 找不到 nodemon
IBM Cloud - Node.js app won't deploy - nodemon not found
我的 Node.js 应用程序不再部署说 nodemon: not found
。它在 3 天前工作,我没有更改任何代码,所以不确定问题是什么。是的,nodemon
在我的 package.json
中。
2018-02-11T09:56:36.77-0500 [CELL/0] OUT Creating container
2018-02-11T09:56:38.02-0500 [CELL/0] OUT Successfully created container
2018-02-11T09:56:46.06-0500 [CELL/0] OUT Starting health monitoring of container
2018-02-11T09:56:46.97-0500 [APP/PROC/WEB/0] OUT > my-api@0.1.0 start /home/vcap/app
2018-02-11T09:56:46.97-0500 [APP/PROC/WEB/0] OUT > nodemon ./src/server.js --exec babel-node -e js
2018-02-11T09:56:46.98-0500 [APP/PROC/WEB/0] ERR sh: 1: nodemon: not found
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Linux 4.4.0-109-generic
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! node v6.12.3
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! npm v3.10.10
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! file sh
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! errno ENOENT
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! syscall spawn
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! my-api@0.1.0 start: `nodemon ./src/server.js --exec babel-node -e js`
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! spawn ENOENT
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR!
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Failed at the my-api@0.1.0 start script 'nodemon ./src/server.js --exec babel-node -e js'.
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Make sure you have the latest version of node.js and npm installed.
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! If you do, this is most likely a problem with the my-api package,
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! not with npm itself.
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Tell the author that this fails on your system:
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! nodemon ./src/server.js --exec babel-node -e js
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! You can get information on how to open an issue for this project with:
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! npm bugs my-api
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Or if that isn't available, you can get their info via:
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! npm owner ls my-api
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! There is likely additional logging output above.
2018-02-11T09:56:47.00-0500 [APP/PROC/WEB/0] ERR npm ERR! Please include the following file with any support request:
2018-02-11T09:56:47.00-0500 [APP/PROC/WEB/0] ERR npm ERR! /home/vcap/app/npm-debug.log
2018-02-11T09:56:47.02-0500 [APP/PROC/WEB/0] OUT Exit status 1
2018-02-11T09:56:47.03-0500 [CELL/0] OUT Exit status 0
2018-02-11T09:56:47.04-0500 [CELL/0] OUT Stopping instance 9c032c0c-808a-4d3b-58c6-7a9d
2018-02-11T09:56:47.04-0500 [CELL/0] OUT Destroying container
2018-02-11T09:56:47.08-0500 [API/1] OUT Process has crashed with type: "web"
2018-02-11T09:56:47.10-0500 [API/1] OUT App instance exited with guid 2ab9a2a6-d4e7-4f6c-a2a5-cb228507af6b payload: {"instance"=>"9c032c0c-808a-4d3b-58c6-7a9d", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>5, "crash_timestamp"=>1518361007050955995, "version"=>"d7f77b8a-4ed4-4b53-bd23-33e78b6a8883"}
2018-02-11T09:56:48.91-0500 [CELL/0] OUT Successfully destroyed container
编辑:奇怪的是,当我手动安装 npm 时它起作用了:
#!/bin/bash
export PATH=/opt/IBM/node-v6.7.0/bin:$PATH # added
npm install # added
cf push "${CF_APP}"
然而,这不是一个有效的解决方案,因为 Cloud Foundry 部署应该为您 npm install
,这样做会使部署花费两倍的时间。
devDependencies
没有安装,所以我不得不把一些东西移到 dependencies
。
我的 Node.js 应用程序不再部署说 nodemon: not found
。它在 3 天前工作,我没有更改任何代码,所以不确定问题是什么。是的,nodemon
在我的 package.json
中。
2018-02-11T09:56:36.77-0500 [CELL/0] OUT Creating container
2018-02-11T09:56:38.02-0500 [CELL/0] OUT Successfully created container
2018-02-11T09:56:46.06-0500 [CELL/0] OUT Starting health monitoring of container
2018-02-11T09:56:46.97-0500 [APP/PROC/WEB/0] OUT > my-api@0.1.0 start /home/vcap/app
2018-02-11T09:56:46.97-0500 [APP/PROC/WEB/0] OUT > nodemon ./src/server.js --exec babel-node -e js
2018-02-11T09:56:46.98-0500 [APP/PROC/WEB/0] ERR sh: 1: nodemon: not found
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Linux 4.4.0-109-generic
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! node v6.12.3
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! npm v3.10.10
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! file sh
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! errno ENOENT
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! syscall spawn
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! my-api@0.1.0 start: `nodemon ./src/server.js --exec babel-node -e js`
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! spawn ENOENT
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR!
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Failed at the my-api@0.1.0 start script 'nodemon ./src/server.js --exec babel-node -e js'.
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Make sure you have the latest version of node.js and npm installed.
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! If you do, this is most likely a problem with the my-api package,
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! not with npm itself.
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Tell the author that this fails on your system:
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! nodemon ./src/server.js --exec babel-node -e js
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! You can get information on how to open an issue for this project with:
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! npm bugs my-api
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! Or if that isn't available, you can get their info via:
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! npm owner ls my-api
2018-02-11T09:56:46.99-0500 [APP/PROC/WEB/0] ERR npm ERR! There is likely additional logging output above.
2018-02-11T09:56:47.00-0500 [APP/PROC/WEB/0] ERR npm ERR! Please include the following file with any support request:
2018-02-11T09:56:47.00-0500 [APP/PROC/WEB/0] ERR npm ERR! /home/vcap/app/npm-debug.log
2018-02-11T09:56:47.02-0500 [APP/PROC/WEB/0] OUT Exit status 1
2018-02-11T09:56:47.03-0500 [CELL/0] OUT Exit status 0
2018-02-11T09:56:47.04-0500 [CELL/0] OUT Stopping instance 9c032c0c-808a-4d3b-58c6-7a9d
2018-02-11T09:56:47.04-0500 [CELL/0] OUT Destroying container
2018-02-11T09:56:47.08-0500 [API/1] OUT Process has crashed with type: "web"
2018-02-11T09:56:47.10-0500 [API/1] OUT App instance exited with guid 2ab9a2a6-d4e7-4f6c-a2a5-cb228507af6b payload: {"instance"=>"9c032c0c-808a-4d3b-58c6-7a9d", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"APP/PROC/WEB: Exited with status 1", "crash_count"=>5, "crash_timestamp"=>1518361007050955995, "version"=>"d7f77b8a-4ed4-4b53-bd23-33e78b6a8883"}
2018-02-11T09:56:48.91-0500 [CELL/0] OUT Successfully destroyed container
编辑:奇怪的是,当我手动安装 npm 时它起作用了:
#!/bin/bash
export PATH=/opt/IBM/node-v6.7.0/bin:$PATH # added
npm install # added
cf push "${CF_APP}"
然而,这不是一个有效的解决方案,因为 Cloud Foundry 部署应该为您 npm install
,这样做会使部署花费两倍的时间。
devDependencies
没有安装,所以我不得不把一些东西移到 dependencies
。