Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
231 views
in Technique[技术] by (71.8m points)

node.js - Amazon Elastic Beanstalk node and npm non-standard install locations

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.

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

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.

how do I get a consistent filepath for these executables? and why does EB do this?

for reference, I tried setting the NodeVersion option in an .ebextensions/app.config, it had no effect on the install location.

question from:https://stackoverflow.com/questions/18214266/amazon-elastic-beanstalk-node-and-npm-non-standard-install-locations

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

I couldn't figure out how to prevent beanstalk commands from resetting the $PATH back again.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...