[英]Elastic Beanstalk upload and deploy error: Error: Cannot find module 'semver'
This is my first time uploading a Node.js/Express app to Elastic Beanstalk/AWS. 这是我第一次将Node.js / Express应用程序上传到Elastic Beanstalk / AWS。 The
server
folder uploaded fine. server
文件夹上传正常。 But on another environment, my client
folder failed to load. 但是在另一个环境中,我的
client
文件夹无法加载。
module.js:478
throw err;
^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/app/current/build/check-versions.js:2:14)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
I don't understand this error or the cause. 我不了解此错误或原因。 Can anyone help?
有人可以帮忙吗?
It prompts to reinstall/upgrade node, but I don't believe I can do so on AWS ... 它提示重新安装/升级节点,但是我不相信我可以在AWS上这样做。
Full log: 完整日志:
-------------------------------------
/var/log/nodejs/nodejs.log
-------------------------------------
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 start script 'node build/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls client
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
> client@1.0.0 start /var/app/current
> node build/build.js
module.js:478
throw err;
^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/app/current/build/check-versions.js:2:14)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
npm ERR! Linux 4.14.62-65.117.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/npm" "start"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! client@1.0.0 start: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 start script 'node build/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls client
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
> client@1.0.0 start /var/app/current
> node build/build.js
module.js:478
throw err;
^
Error: Cannot find module 'semver'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/app/current/build/check-versions.js:2:14)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
npm ERR! Linux 4.14.62-65.117.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.14.3-linux-x64/bin/npm" "start"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! client@1.0.0 start: `node build/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 start script 'node build/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the client package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node build/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs client
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls client
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
The problem was my own lack of knowledge about Node deployments. 问题是我自己对节点部署缺乏了解。 I was trying to upload my entire client folder.
我试图上传我的整个客户文件夹。
What I should have done is run npm run build
to create a dist
file (using a long webpack script) and uploaded that to AWS. 我应该做的是运行
npm run build
来创建dist
文件(使用较长的webpack脚本)并将其上传到AWS。 In that case, none of these dependencies are required as the files are served statically. 在这种情况下,这些文件都不需要,因为文件是静态提供的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.