由于错误 raw-socket@1.4.0 安装脚本'node-gyp rebuild',无法安装 net::p ing



我无法在nodejs中使用net:ping模块。当我尝试安装模块时,它给了我以下错误。。请帮助

npm install net-ping
raw-socket@1.4.0 install /root/node_modules/raw-socket
node-gyp rebuild
Traceback (most recent call last):
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
sys.exit(gyp.script_main())
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
return main(sys.argv[1:])
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
return gyp_main(args)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 514, in gyp_main
options.duplicate_basename_check)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 130, in Load
params['parallel'], params['root_targets'])
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2775, in Load
variables, includes, depth, check, True)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
includes, True, check)
File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 243, in LoadOneBuildFile
None)
File "binding.gyp", line 1
{
 ^
SyntaxError: invalid syntax
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
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 Linux 2.6.32-504.12.2.el6.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/node_modules/raw-socket
gyp ERR! node -v v5.4.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.
npm ERR! Linux 2.6.32-504.12.2.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "net-ping"
npm ERR! node v5.4.0
npm ERR! npm  v3.5.3
npm ERR! code ELIFECYCLE
npm ERR! raw-socket@1.4.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the raw-socket@1.4.0 install script 'node-gyp rebuild'.
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 raw-socket package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs raw-socket
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls raw-socket
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /root/npm-debug.log

谢谢&当做Tej Pratap Bisht

升级至node的最新版本。它在版本0.12.0(nvm安装0.12.0)上对我有效

最新更新