newrelic / node-native-metrics

Optional native module for collecting low-level Node & V8 metrics
Apache License 2.0
63 stars 41 forks source link

Can't resolve 'npm' #170

Closed dolivervl closed 2 years ago

dolivervl commented 2 years ago

Hello all, I installed newrelic node agent and had issue with native-metrics.

My package.json { "name": -frontend", "version": "1.0.0", "private": true, "dependencies": { "@newrelic/native-metrics": "^7.0.2", "axios": "^0.19.0", "bootstrap": "^4.4.1", "firebase": "^8.10.0", "flipping-pages": "^2.1.3", "formik": "^2.0.6", "newrelic": "^8.7.0", "node-gyp": "^8.4.1", "nuka-carousel": "4.6.7", "rc-tween-one": "^2.6.5", "react": "^16.12.0", "react-bootstrap": "^1.0.0-beta.16", "react-dom": "^16.12.0", "react-drag-drawer": "^3.3.3", "react-flip-page": "^1.6.0", "react-icons": "^4.3.1", "react-input-mask": "^2.0.4", "react-loader-spinner": "^3.1.14", "react-screen-orientation": "^0.0.4", "react-scripts": "3.2.0", "react-scroll-parallax": "^2.3.5", "smoothscroll-polyfill": "^0.4.4", "yup": "^0.28.0" }, "scripts": { "dev": "REACT_APP_ENV=development react-scripts start", "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }

Error after executed npm run start ./node_modules/@newrelic/native-metrics/lib/pre-build.js Module not found: Can't resolve 'npm' in '/home/diego/Documentos/PROJETO/frontend/node_modules/@newrelic/native-metrics/lib' Node 16.13.2 NPM 8.3.0 Ubuntu 20.04.3 LTS(64bits)

michaelgoin commented 2 years ago

Is this erroring out or just logging the message?

I'm surprised either way as we seem to be swallowing the error...

https://github.com/newrelic/node-native-metrics/blob/main/lib/pre-build.js#L118-L126

This is a part of the fallbacks for finding node-gyp for compilation. Upon graceful failure, it should fall back to downloading a pre-built binary for Linux distros. If it is not getting that far and you have network access during install, you can set the ENV var NR_NATIVE_METRICS_NO_BUILD=1 prior to install as a workaround which will skip trying build and jump straight to downloading.

coreyarnold commented 2 years ago

@dolivervl We wanted to reach out and see if you're still having an issue or if your issue was resolved. We'll assume you're good to go if we don't hear back in the next few days and close this issue out.

Thanks, Corey

coreyarnold commented 2 years ago

Closing since this issue seems to have gone cold. @dolivervl please reopen if this is still an issue.