Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Elastic Beanstalk deploy fails on native-metrics install

releases

#1

We’ve been using New Relic in our production Node.js app for a few months without any problems. Yesterday all new attempts to deploy to Elastic Beanstalk began failing with this error:

> @newrelic/native-metrics@2.1.1 install /tmp/deployment/application/node_modules/@newrelic/native-metrics
> node-gyp rebuild

make: Entering directory `/tmp/deployment/application/node_modules/@newrelic/native-metrics/build'
  CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
Running npm install:  /opt/elasticbeanstalk/node-install/node-v7.6.0-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 2017/09/02 16:05:58 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>
g++: internal compiler error: Killed (program cc1plus)
    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-v7.6.0-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status -9
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [Release/obj.target/native_metrics/src/native_metrics.o] Error 4
make: Leaving directory `/tmp/deployment/application/node_modules/@newrelic/native-metrics/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/elasticbeanstalk/node-install/node-v7.6.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:192:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.9.43-17.38.amzn1.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v7.6.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v7.6.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/deployment/application/node_modules/@newrelic/native-metrics
gyp ERR! node -v v7.6.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok  (ElasticBeanstalk::ExternalInvocationError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install

I’ve tried many of the suggestions here and here to no avail.

Any ideas how to fix this other than removing New Relic from our project?


#2

It appears it is failing trying to build the @newrelic/native-metrics module which is an optional dependency as of the 2.0.0 release. Perhaps this is the first 2.x release you’ve attempted to deploy? Since it is an optional dependency, in general, it should be fine if it is unable to build but it sounds like you’re saying that EB fails the deploy at this point? If that is the case, as a temporary workaround, you could pin the version in your package.json to 1.40.0 which is the most recent 1.x release (which doesn’t have the optional dependency).


#3

Thanks for the response. Yes for some reason EB fails the deploy when @newrelic/native-metrics doesn’t build. Before your response, I upgraded to newrelic 2.2.0 and was able to deploy successfully twice. Thanks for the heads up about version 1.40.0—if future deploys fail due to native-metrics, I’ll try going back down to that version.


#4

Let us know which version is working for ya, @stenrap!

There is a chance that others in the community are experiencing this and we would love to hear more about your experience and resolution! Thanks!


#5

We’re currently running newrelic 2.2.0, and our last two EB deploys were successful with this version. We have another deploy coming up this week, and we plan to stick with 2.2.0, so I’ll post again if there are any problems.


#6

We’re also having issues running New Relic for Node.js on Elastic Beanstalk. I’m using ‘newrelic’ v4.1.0, which also installs ‘@newrelic/native-metrics’ v2.1.0.

We’re using platform version “Node.js running on 64bit Amazon Linux/4.5.0” with Node.js v8.11.1. Here’s the error we’re running into:

-------------------------------------
/var/log/eb-activity.log
-------------------------------------
  gyp ERR! clean error 
  gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
  gyp ERR! System Linux 4.14.33-51.37.amzn1.x86_64
  gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean" "configure"
  gyp ERR! cwd /tmp/deployment/application/node_modules/@newrelic/native-metrics
  gyp ERR! node -v v8.11.1
  gyp ERR! node-gyp -v v3.6.2
  gyp ERR! not ok 
  Error: Failed to execute install: Error: Failed to install module: Error: Failed to execute /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure: code 1; Error: EEXIST: file already exists, mkdir '/tmp/deployment/application/node_modules/@newrelic/native-metrics/build'
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! @newrelic/native-metrics@2.4.0 install: `node ./lib/pre-build.js install native_metrics`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the @newrelic/native-metrics@2.4.0 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/2018-05-15T06_42_56_112Z-debug.log
  Running npm install:  /opt/elasticbeanstalk/node-install/node-v8.11.1-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 2018/05/15 06:42:56 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.11.1-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 1 (ElasticBeanstalk::ExternalInvocationError)
caused by: + /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install
  npm WARN lifecycle myaccount-frontend@1.0.0~postinstall: cannot run in wd %s %s (wd=%s) myaccount-frontend@1.0.0 npm run locales /tmp/deployment/application
  npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
  npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
  npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
  
  up to date in 14.998s
  
  > uglifyjs-webpack-plugin@0.4.6 postinstall /tmp/deployment/application/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
  > node lib/post_install.js
  
  
  > @newrelic/native-metrics@2.4.0 install /tmp/deployment/application/node_modules/@newrelic/native-metrics
  > node ./lib/pre-build.js install native_metrics
  
  > /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
  gyp ERR! clean error 
  gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
  gyp ERR! System Linux 4.14.33-51.37.amzn1.x86_64
  gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "clean" "configure"
  gyp ERR! cwd /tmp/deployment/application/node_modules/@newrelic/native-metrics
  gyp ERR! node -v v8.11.1
  gyp ERR! node-gyp -v v3.6.2
  gyp ERR! not ok 
  Error: Failed to execute install: Error: Failed to install module: Error: Failed to execute /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.11.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure: code 1; Error: EEXIST: file already exists, mkdir '/tmp/deployment/application/node_modules/@newrelic/native-metrics/build'
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! @newrelic/native-metrics@2.4.0 install: `node ./lib/pre-build.js install native_metrics`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the @newrelic/native-metrics@2.4.0 install script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

#7

I too am having the same issue - 64bit Amazon Linux/4.50 - Node.js v8.11.1 (have also tried with 6.13.1).

package.json reference: “newrelic”: “^4.1.1”


#8

Hi guys! I’m having this error with “^4.8.1” have you figured it out?


#9

we’re running “newrelic”: “^4.10.0” on EB 64bit Amazon Linux/4.6.0 - Node.js v8.11.4 and we’re also getting this issue. Any solution?


#10

Hi all, I have a suggestion to try if anyone is still running into this issue. The gyp ERR! stack Error: EACCES: permission denied, rmdir 'build' would actually suggest that this is a permissions problem with gyp that can sometimes happen because node-gyp is run as the default user instead of root. There is a great solution here on Stack Overflow or you can change the permissions of the folder:

sudo chown -R $USERNAME /app

let me know if that fixes the issue @nicholas.barger, @ghengeveld, @facundocolella, @jiri :smiley: