在macOS 10.14 Mojave上,无法安装`newrelic` Node.js模块

时间:2018-11-16 15:21:21

标签: node.js newrelic

自从升级到macOS 10.14 Mojave以来,似乎newrelic(版本4.11.0)Node.js模块的安装失败。

让我们创建一个项目:

$ mkdir test-newrelic
$ cd test-newrelic/
$ npm init
$ npm init --yes

现在,让我们安装newrelic模块:

$ npm install --save newrelic

> @newrelic/native-metrics@3.1.2 install /Users/<user>/Sources/test-newrelic/node_modules/@newrelic/native-metrics
> node ./lib/pre-build.js install native_metrics

> /Users/<user>/.nvm/versions/node/v6.14.4/bin/node /Users/<user>/.nvm/versions/node/v6.14.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean configure
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
> /Users/<user>/.nvm/versions/node/v6.14.4/bin/node /Users/<user>/.nvm/versions/node/v6.14.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 4 native_metrics
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
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
warningwarning: : warningwarninginclude: include:   pathpath  forfor  stdlibc++stdlibc++includeinclude    headerspathheaderspath    notfornotfor    found;stdlibc++found;stdlibc++    passpassheadersheaders    '-std=libc++''-std=libc++'notnot    onfound;onfound;   thethepass   commandcommand'-std=libc++'   linelineon   totothe   useusecommand   thetheline   libc++libc++to   standardstandarduse   librarylibrarythe  insteadinstead  [-Wstdlibcxx-not-found][-Wstdlibcxx-not-found]

pass '-std=libc++' on  the libc++command  standardline  libraryto  insteaduse  [-Wstdlibcxx-not-found]the
libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from ../src/RUsageMeter.cpp:../src/LoopChecker.cpp../src/GCBinder.cpp2:::2210::
:10 :../src/GCBinder.hpp :fatal error3: :fatal error10: :'cstring'  'algorithm'file  fatal errorfilenot:   notfound 'map'found
file
not found
#include <cstring>#include <algorithm>
#include <map>

^~~~~~~~~         ^~~~~~~~~~~
^~~~~

In file included from ../src/native_metrics.cpp:2:
In file included from ../../../nan/nan.h:52:
In file included from /Users/<user>/.node-gyp/6.14.4/include/node/node.h:42:
/Users/<user>/.node-gyp/6.14.4/include/node/v8.h:21:10: fatal error: 'utility' file not found
#include <utility>
^~~~~~~~~
1 warning and 1 error generated.
1 warning and 1 error generated.
1 warning and 1 error generated.
1 warning and 1 error generated.
make: *** [Release/obj.target/native_metrics/src/RUsageMeter.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Release/obj.target/native_metrics/src/native_metrics.o] Error 1
make: *** [Release/obj.target/native_metrics/src/LoopChecker.o] Error 1
make: *** [Release/obj.target/native_metrics/src/GCBinder.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/<user>/.nvm/versions/node/v6.14.4/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 Darwin 18.2.0
gyp ERR! command "/Users/<user>/.nvm/versions/node/v6.14.4/bin/node" "/Users/<user>/.nvm/versions/node/v6.14.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "-j" "4" "native_metrics"
gyp ERR! cwd /Users/<user>/Sources/test-newrelic/node_modules/@newrelic/native-metrics
gyp ERR! node -v v6.14.4
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 /Users/<user>/.nvm/versions/node/v6.14.4/bin/node /Users/<user>/.nvm/versions/node/v6.14.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -j 4 native_metrics: code 1; Error: Failed to download https://download.newrelic.com/nodejs_agent/builds/_newrelic_native_metrics-3_1_2-native_metrics-48-darwin-x64.gz: code 404
test-newrelic@1.0.0 /Users/<user>/Sources/test-newrelic
└─┬ newrelic@4.11.0
├─┬ @newrelic/koa@1.0.7
│ └── methods@1.1.2
├── @newrelic/superagent@1.0.0
├── @tyriar/fibonacci-heap@2.0.8
├─┬ async@2.6.1
│ └── lodash@4.17.11
├─┬ concat-stream@1.6.2
│ ├── buffer-from@1.1.1
│ ├── inherits@2.0.3
│ └── typedarray@0.0.6
├─┬ https-proxy-agent@2.2.1
│ ├─┬ agent-base@4.2.1
│ │ └─┬ es6-promisify@5.0.0
│ │   └── es6-promise@4.2.5
│ └─┬ debug@3.2.6
│   └── ms@2.1.1
├── json-stringify-safe@5.0.1
├─┬ readable-stream@2.3.6
│ ├── core-util-is@1.0.2
│ ├── isarray@1.0.0
│ ├── process-nextick-args@2.0.0
│ ├── safe-buffer@5.1.2
│ ├── string_decoder@1.1.1
│ └── util-deprecate@1.0.2
└── semver@5.6.0

npm WARN test-newrelic@1.0.0 No description
npm WARN test-newrelic@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@3.1.2 (node_modules/@newrelic/native-metrics):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @newrelic/native-metrics@3.1.2 install: `node ./lib/pre-build.js install native_metrics`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

Node-gyp似乎找不到标题。

1 个答案:

答案 0 :(得分:0)

我通过访问以下网站来解决此问题:https://developer.apple.com/download/more/ 并下载了用于Xcode 10的 命令行工具macOS 10.13

安装命令行工具后,尝试执行sudo xcode-select -r(-r表示重置)