我尝试将Node.js应用程序部署到Bluemix,但是失败。
运行cf logs IssueTracker --recent
时看到此错误:
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR module.js:549
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR throw err;
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR ^
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR Error: Cannot find module 'webpack'
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Function.Module._resolveFilename (module.js:547:15)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Function.Module._load (module.js:474:25)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Module.require (module.js:596:17)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at require (internal/module.js:11:18)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:6915)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at r (/home/vcap/app/dist/server.generated.js:1:186)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:11679)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:12243)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at r (/home/vcap/app/dist/server.generated.js:1:186)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:71669)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:73288)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at r (/home/vcap/app/dist/server.generated.js:1:186)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:73356)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at r (/home/vcap/app/dist/server.generated.js:1:186)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at Object.<anonymous> (/home/vcap/app/dist/server.generated.js:1:73750)
2018-12-10T16:50:24.38+0000 [APP/PROC/WEB/0] ERR at r (/home/vcap/app/dist/server.generated.js:1:186)
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR! code ELIFECYCLE
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR! errno 1
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR! issue-tracker-pc@1.0.0 start: `NODE_ENV=production node ./dist/server.generated.js`
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR! Exit status 1
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR!
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR! Failed at the issue-tracker-pc@1.0.0 start script.
2018-12-10T16:50:24.43+0000 [APP/PROC/WEB/0] ERR npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2018-12-10T16:50:24.45+0000 [APP/PROC/WEB/0] ERR npm ERR! A complete log of this run can be found in:
2018-12-10T16:50:24.45+0000 [APP/PROC/WEB/0] ERR npm ERR! /home/vcap/app/.npm/_logs/2018-12-10T16_50_24_438Z-debug.log
我是Cloud Foundry的新手,所以不确定下一步该怎么做。我该如何解决?
答案 0 :(得分:1)
您的应用似乎缺少依赖项:Error: Cannot find module 'webpack'
。
CF正在运行以启动您的应用程序的命令为NODE_ENV=production node ./dist/server.generated.js
。尝试在本地运行,看看是否可以复制。
您可能还想尝试在干净的VM上运行,以排除缺少的依赖项在开发人员工作站上全局安装的情况。当您的应用程序在CF上运行时,全局安装的依赖项将不可用。唯一可用的是NPM / Yarn根据您的package.json文件安装的内容。
希望有帮助!
答案 1 :(得分:0)
在我的情况下,package.json输入错误。 请交叉验证