Benson Wally Tran
Benson Wally Tran

Reputation: 339

AWS Elastic Beanstalk Node.js npm install error

During the deployment of an application, npm install is unable to install a very particular dependency:

npm ERR! enoent ENOENT: no such file or directory, chmod '/tmp/deployment/application/node_modules/babel-core/node_modules/regexpu/node_modules/regjsparser/node_modules/jsesc/bin/jsesc'

I was able to find that above error by ssh'ing into the particular EC2 instance hosting my Node application and running npm install via the command below:

sudo /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 2

Then follows with this generic failure:

Failed to run npm install. Snapshot logs for more details. No environment variable EB_EVENT_FILE found. Writing message to stderr. Msg: Failed to run npm install. Snapshot logs for more details.

What's weird is that I've been able to deploy successfully once before, and am using the same exact configurations for that previous deployment. My only command is npm start within .ebextensions/.

Within my package.json, I changed all dev dependencies into dependencies, as webpack is building during prestart.

This all builds and runs locally, by the way. Also I'm using Node 4.2.1 and npm 2.14.7 on EB.

Any help would be awesome. Thanks!

Upvotes: 4

Views: 1913

Answers (1)

Benson Wally Tran
Benson Wally Tran

Reputation: 339

I ended up just creating and deploying a Docker container to solve this issue. Deploying to the environment provided by EB is too nondeterministic - the dependency tree wasn't created correctly.

Upvotes: 1

Related Questions