找不到命令:node-inspector

时间:2015-11-04 21:57:46

标签: node.js express node-inspector

当我运行node-inspector和node-debug app.js.我收到了:

zsh: command not found: node-inspector
zsh: command not found: node-debug

奇怪的是,当我运行节点--debug时,我会收到:

Debugger listening on port 5858

我最近重新运行了sudo npm install -g node-inspector

npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"5.0.0","npm":"3.3.6"})
npm WARN lifecycle v8-debug@0.5.4~preinstall: cannot run in wd %s %s (wd=%s) v8-debug@0.5.4   /usr/local/lib/node_modules/.staging/v8-debug-d56ef3c156d39eeb44cda4964e0a85c5
npm WARN lifecycle v8-profiler@5.3.2~preinstall: cannot run in wd %s %s (wd=%s) v8-profiler@5.3.2   /usr/local/lib/node_modules/.staging/v8-profiler-700a09d0cc4475efe8f794ecb7f798e3
/usr/local/bin/node-inspector -> /usr/local/lib/node_modules/node-inspector/bin/inspector.js
/usr/local/bin/node-debug -> /usr/local/lib/node_modules/node-inspector/bin/node-debug.js

> bufferutil@1.2.1 install /usr/local/lib/node_modules/node-inspector/node_modules/bufferutil
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zfine/.node-gyp/5.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-inspector/node_modules/bufferutil/.node-gyp"
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node

> utf-8-validate@1.2.1 install /usr/local/lib/node_modules/node-inspector/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zfine/.node-gyp/5.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-inspector/node_modules/utf-8-validate/.node-gyp"
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

> bufferutil@1.2.1 install /usr/local/lib/node_modules/node-inspector/node_modules/bufferutil
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zfine/.node-gyp/5.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-inspector/node_modules/bufferutil/.node-gyp"
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node

> utf-8-validate@1.2.1 install /usr/local/lib/node_modules/node-inspector/node_modules/utf-8-validate
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zfine/.node-gyp/5.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-inspector/node_modules/utf-8-validate/.node-gyp"
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

> v8-debug@0.5.4 install /usr/local/lib/node_modules/node-inspector/node_modules/v8-debug
> node-pre-gyp install --fallback-to-build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zfine/.node-gyp/5.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/.node-gyp"
make: *** No rule to make target `../.node-gyp/5.0.0/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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.5.4/node-v47-darwin-x64/debug.node" "--module_name=debug" "--module_path=/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.5.4/node-v47-darwin-x64"
gyp ERR! cwd /usr/local/lib/node_modules/node-inspector/node_modules/v8-debug
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.5.4/node-v47-darwin-x64/debug.node --module_name=debug --module_path=/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.5.4/node-v47-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-inspector/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 15.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-inspector/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/node-inspector/node_modules/v8-debug
node-pre-gyp ERR! node -v v5.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.14
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.5.4/node-v47-darwin-x64/debug.node --module_name=debug --module_path=/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.5.4/node-v47-darwin-x64' (1)
npm WARN install:v8-debug v8-debug@0.5.4 install: `node-pre-gyp install --fallback-to-build`
npm WARN install:v8-debug Exit status 1

> v8-profiler@5.3.2 install /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler
> node-pre-gyp install --fallback-to-build

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/zfine/.node-gyp/5.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/.node-gyp"
make: *** No rule to make target `../.node-gyp/5.0.0/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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/build/profiler/v5.3.2/node-v47-darwin-x64/profiler.node" "--module_name=profiler" "--module_path=/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/build/profiler/v5.3.2/node-v47-darwin-x64"
gyp ERR! cwd /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/build/profiler/v5.3.2/node-v47-darwin-x64/profiler.node --module_name=profiler --module_path=/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/build/profiler/v5.3.2/node-v47-darwin-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-inspector/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:818:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Darwin 15.0.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-inspector/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler
node-pre-gyp ERR! node -v v5.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.14
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/build/profiler/v5.3.2/node-v47-darwin-x64/profiler.node --module_name=profiler --module_path=/usr/local/lib/node_modules/node-inspector/node_modules/v8-profiler/build/profiler/v5.3.2/node-v47-darwin-x64' (1)
npm WARN install:v8-profiler v8-profiler@5.3.2 install: `node-pre-gyp install --fallback-to-build`
npm WARN install:v8-profiler Exit status 1
/usr/local/lib
└── (empty)

npm ERR! code 1

我正在运行OSX 10.11.1。

node:v5.0.0

npm:3.3.6

我可能弄乱了PATH变量,如Stack中的类似问题所示。然而他们的PATH看起来不同。如果实际上是这种情况,我需要将导出PATH添加到我的.bash_profile中吗?在此先感谢!!

1 个答案:

答案 0 :(得分:2)

如果在命令行上传递--unsafe-perm,它应该可以工作。

像:     $ sudo npm install -g pkg_name --unsafe-perm

原因:在OSX El Capitan上,苹果删除了超级用户的完全访问权限,以解决一些安全问题。