Recently I have been unable to deploy to my Elastic Beanstalk environment. The error is due to a node package. The node package in question is not in my package.json as its dependency of another package. I believe the issue is to do with how Bitbucket Pipelines installs the package as I can successfully zip up my local directory and deploy manually and it works fine.
Here is the error output:
[2020-06-17T12:51:50.566Z] ERROR [30079] : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
removed 1 package and audited 707 packages in 4.958s
found 13 vulnerabilities (2 low, 6 moderate, 5 high)
run `npm audit fix` to fix them, or `npm audit` for details
> core-js@2.6.11 postinstall /tmp/deployment/application/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
[96mThank you for using core-js ( [94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library! [0m
[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: [0m
[96m> [94m https://opencollective.com/core-js [0m
[96m> [94m https://www.patreon.com/zloirock [0m
[96mAlso, the author of core-js ( [94m https://github.com/zloirock [96m) is looking for a good job -) [0m
> protobufjs@6.9.0 postinstall /tmp/deployment/application/node_modules/protobufjs
> node scripts/postinstall
> grpc@1.24.3 install /tmp/deployment/application/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
module.js:550
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tmp/deployment/application/node_modules/.bin/node-pre-gyp:15:20)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.24.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.24.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2020-06-17T12_51_50_548Z-debug.log
Running npm install: /opt/elasticbeanstalk/node-install/node-v8.16.2-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
UTC 2020/06/17 12:51:50 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v8.16.2-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 1 (ElasticBeanstalk::ExternalInvocationError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
removed 1 package and audited 707 packages in 4.958s
found 13 vulnerabilities (2 low, 6 moderate, 5 high)
run `npm audit fix` to fix them, or `npm audit` for details
> core-js@2.6.11 postinstall /tmp/deployment/application/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
[96mThank you for using core-js ( [94m https://github.com/zloirock/core-js [96m) for polyfilling JavaScript standard library! [0m
[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: [0m
[96m> [94m https://opencollective.com/core-js [0m
[96m> [94m https://www.patreon.com/zloirock [0m
[96mAlso, the author of core-js ( [94m https://github.com/zloirock [96m) is looking for a good job -) [0m
> protobufjs@6.9.0 postinstall /tmp/deployment/application/node_modules/protobufjs
> node scripts/postinstall
> grpc@1.24.3 install /tmp/deployment/application/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
module.js:550
throw err;
^
Error: Cannot find module '../'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/tmp/deployment/application/node_modules/.bin/node-pre-gyp:15:20)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.24.3 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.24.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2020-06-17T12_51_50_548Z-debug.log
Running npm install: /opt/elasticbeanstalk/node-install/node-v8.16.2-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
UTC 2020/06/17 12:51:50 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log
Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v8.16.2-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
[2020-06-17T12:51:50.566Z] ERROR [30079] : Command CMD-AppDeploy failed!
[2020-06-17T12:51:50.567Z] INFO [30079] : Command processor returning results: