问题描述
亚马逊青苗安装节点,NPM到真正不起眼的地方 - 我不知道,如果EB决定使用新版本的节点,这将导致我的应用程序,以打破,他们将不会改变。
Amazon Beanstalk installs node and npm into really obscure places - and I'm not sure they won't change if EB decides to use a newer version of node, which would cause my application to break.
这些都是节点和NPM的位置:
These are the locations for node and npm:
/opt/elasticbeanstalk/node-install/node-v0.8.24-linux-x64/bin/node
/opt/elasticbeanstalk/node-install/node-v0.8.24-linux-x64/bin/npm
我很担心 0.8.24
部分变更,并试图找到的东西,通常只是当我不想用grep的东西在cron或monit的脚本的/ usr / bin中/ XXX
。
I'm worried about the 0.8.24
part changing and I'd rather not grep for things in cron or monit scripts when trying to find something that is normally just /usr/bin/XXX
.
我如何得到一个一致的文件路径为这些可执行文件?而为什么EB做到这一点?
how do I get a consistent filepath for these executables? and why does EB do this?
仅供参考,我试过设置在 .ebextensions /的app.config
,它没有任何的 NodeVersion
选项在安装位置影响。
for reference, I tried setting the NodeVersion
option in an .ebextensions/app.config
, it had no effect on the install location.
推荐答案
您可以添加最新的节点和 NPM 二进制文件$ PATH像这样的命令:
You can add the most recent node and npm binaries to $PATH with a command like this:
PATH=$PATH:`ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin
我无法弄清楚如何起价回来重置$路径P $ pvent豆茎命令。
I couldn't figure out how to prevent beanstalk commands from resetting the $PATH back again.
如果你愿意的话,你也许可以创建一个命令一个符号链接类似于上面,并用其作为在cron脚本参考点等。
If you are so inclined you can probably create a symlink with a command similar to the above and use that as your reference point in cron scripts etc.
同意,这是非常非常讨厌。
Agreed, it is very very annoying.
这篇关于亚马逊弹性魔豆节点和新公共管理不规范的安装位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!