Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodejs agent failing on native-metrics #323

Open
tophercullen opened this issue Jan 6, 2018 · 0 comments
Open

Nodejs agent failing on native-metrics #323

tophercullen opened this issue Jan 6, 2018 · 0 comments

Comments

@tophercullen
Copy link

tophercullen commented Jan 6, 2018

Recently chef runs start to fail due to newrelic. The issue seems to be that chef-client is running as roo. The workaround I found from google was adding --unsafe-perm to the npm install command.

See log below
With --unsafe-perm


   * execute[npm-install-nodejs_agent] action run[2018-01-06T17:50:07+00:00] INFO: Processing execute[npm-install-nodejs_agent] action run (/var/chef/cache/cookbooks/newrelic/providers/agent_nodejs.rb line 34)

      [execute] 
                > @newrelic/native-metrics@2.1.2 install /opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics
                > node ./lib/pre-build.js --no-download install native_metrics
                
                > /usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
                > /usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 1 native_metrics
                make: Entering directory `/opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics/build'
                  CXX(target) Release/obj.target/native_metrics/src/native_metrics.o
                  CXX(target) Release/obj.target/native_metrics/src/GCBinder.o
                  CXX(target) Release/obj.target/native_metrics/src/LoopChecker.o
                  CXX(target) Release/obj.target/native_metrics/src/RUsageMeter.o
                  SOLINK_MODULE(target) Release/obj.target/native_metrics.node
                  COPY Release/native_metrics.node
                make: Leaving directory `/opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics/build'
                install successful: _newrelic_native_metrics-2_1_2-native_metrics-48-linux-x64
                myapp@1.0.90 /opt/myappdir/myapp/myapp
                └─┬ newrelic@2.4.2 
                  ├── @newrelic/native-metrics@2.1.2 
                  ├─┬ concat-stream@1.6.0 
                  │ ├─┬ readable-stream@2.3.3 
                  │ │ └── string_decoder@1.0.3 
                  │ └── typedarray@0.0.6 
                  ├─┬ https-proxy-agent@0.3.6 
                  │ └── agent-base@1.0.2 
                  ├─┬ readable-stream@2.3.3 
                  │ ├── safe-buffer@5.1.1 
                  │ └── string_decoder@1.0.3 
                  └── semver@5.4.1 
                
                npm WARN myapp@1.0.90 No description
                npm WARN myapp@1.0.90 No repository field.

Without --unsafe-perm

[2018-01-06T16:24:58+00:00] INFO: Running queued delayed notifications before re-raising exception
    
    ================================================================================
    Error executing action `install` on resource 'newrelic_agent_nodejs[/opt/myappdir/myapp/myapp]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    execute[npm-install-nativemetrics] (/var/chef/cache/cookbooks/newrelic/providers/agent_nodejs.rb line 34) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
    ---- Begin output of npm install @newrelic/native-metrics ----
    STDOUT: > @newrelic/native-metrics@2.1.2 install /opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics
    > node ./lib/pre-build.js --no-download install native_metrics
    
    > /usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
    > /usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 1 native_metrics
    make: Entering directory `/opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics/build'
    make: Leaving directory `/opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics/build'
    STDERR: gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.12.2"
    gyp WARN EACCES attempting to reinstall using temporary dev dir "/opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics/.node-gyp"
    make: *** No rule to make target `../.node-gyp/6.12.2/include/node/common.gypi', needed by `Makefile'.  Stop.
    gyp ERR! build error 
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/usr/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:191:7)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
    gyp ERR! System Linux 4.9.58-18.55.amzn1.x86_64
    gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "-j" "1" "native_metrics"
    gyp ERR! cwd /opt/myappdir/myapp/myapp/node_modules/@newrelic/native-metrics
    gyp ERR! node -v v6.12.2
    gyp ERR! node-gyp -v v3.4.0
    gyp ERR! not ok 
    Error: Failed to execute install: Error: Failed to install module: Error: Failed to execute /usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 1 native_metrics: code 1; Error: Downloading is disabled.
    npm WARN myapp@1.0.90 No description
    npm WARN myapp@1.0.90 No repository field.
    npm ERR! Linux 4.9.58-18.55.amzn1.x86_64
    npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "@newrelic/native-metrics"
    npm ERR! node v6.12.2
    npm ERR! npm  v3.10.10
    npm ERR! code ELIFECYCLE
    
    npm ERR! @newrelic/native-metrics@2.1.2 install: `node ./lib/pre-build.js --no-download install native_metrics`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the @newrelic/native-metrics@2.1.2 install script 'node ./lib/pre-build.js --no-download install native_metrics'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the @newrelic/native-metrics package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node ./lib/pre-build.js --no-download install native_metrics
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR!     npm bugs @newrelic/native-metrics
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR!     npm owner ls @newrelic/native-metrics
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR!     /opt/myappdir/myapp/myapp/npm-debug.log
    ---- End output of npm install @newrelic/native-metrics ----
    Ran npm install @newrelic/native-metrics returned 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant