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

npm install error!!! #21

Closed
heartblueflower opened this issue Apr 21, 2016 · 17 comments
Closed

npm install error!!! #21

heartblueflower opened this issue Apr 21, 2016 · 17 comments

Comments

@heartblueflower
Copy link

./npm install net-ping
-|/-|/-|/-|/--|/-|/-|/--\

raw-socket@1.4.0 install /home/node-v4.4.3-linux-x64/bin/node_modules/net-ping/node_modules/raw-socket
node-gyp rebuild

Traceback (most recent call last):
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 16, in
sys.exit(gyp.script_main())
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 545, in script_main
return main(sys.argv[1:])
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 538, in main
return gyp_main(args)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 514, in gyp_main
options.duplicate_basename_check)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 130, in Load
params['parallel'], params['root_targets'])
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2775, in Load
variables, includes, depth, check, True)
File "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 391, in LoadTargetBuildFile
includes, True, check)
File "/home/node-v4.4.3-linux-x64/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 (/home/node-v4.4.3-linux-x64/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-431.el6.x86_64
gyp ERR! command "/home/node-v4.4.3-linux-x64/bin/node" "/home/node-v4.4.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/node-v4.4.3-linux-x64/bin/node_modules/net-ping/node_modules/raw-socket
gyp ERR! node -v v4.4.3
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 2.6.32-431.el6.x86_64
npm ERR! argv "/home/node-v4.4.3-linux-x64/bin/node" "/home/node-v4.4.3-linux-x64/bin/npm" "install" "net-ping"
npm ERR! node v4.4.3
npm ERR! npm v2.15.1
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! 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 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! /home/node-v4.4.3-linux-x64/bin/npm-debug.log

@tinnocente
Copy link

same - after upgrading to latest version of Node this module no longer works.

@stephenwvickers
Copy link
Collaborator

I haven't had time to look into this too much, but a quick test on a MacBook pro doesn't experience the same issue:

Stephens-MBP:np5 stephen$ npm install net-ping
\
> raw-socket@1.4.0 install /Users/stephen/Tmp/node_modules/net-ping/node_modules/raw-socket
> node-gyp rebuild

  CXX(target) Release/obj.target/raw/src/raw.o
  SOLINK_MODULE(target) Release/raw.node
net-ping@1.2.0 ../node_modules/net-ping
└── raw-socket@1.4.0 (nan@2.0.9)
Stephens-MBP:np5 stephen$ node -v
v4.4.3
Stephens-MBP:np5 stephen$ npm -v
2.15.1

Steve

@tinnocente
Copy link

Hey Steve, I see you're on node v.4.4.3 whereas I am on 5.10.1

Attached is my debug log. Hope it helps!

npm-debug.txt

@stephenwvickers
Copy link
Collaborator

What version of Python are you using?

@tinnocente
Copy link

Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)

@tinnocente
Copy link

Hi Stephen, should I try updating Python?

@stephenwvickers
Copy link
Collaborator

Yes, I would say yes, python 2.7 is recommended by node-gyp and that's what I use.

I have installed successfully with node 5.11.0 using npm 3.8.6 and python 2.7.

@al095660
Copy link

al095660 commented Apr 26, 2016

I have a problem here (don't think it's the same as @tinnocente), and i have node, npm and python updated (same versions you pointed above). Any thoughts?

C:\node\watchbot>npm install net-ping --save
> raw-socket@1.4.0 install C:\node\watchbot\node_modules\raw-socket
> node-gyp rebuild
C:\node\watchbot\node_modules\raw-socket>if not defined npm_config_node_gyp (nod
e "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules
\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available too
ls versions are "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:204:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\node\watchbot\node_modules\raw-socket
gyp ERR! node -v v5.11.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN watchbot@1.0.0 No repository field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "net-ping" "--save"
npm ERR! node v5.11.0
npm ERR! npm  v3.8.6
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!     C:\node\watchbot\npm-debug.log
C:\node\watchbot>

Debug log: npm-debug.txt

@al095660
Copy link

Solved. As the error message says, MSBUILD was using the wrong tools, so googling it up, i just had to install Microsoft Visual Studio 2013 with C++ redist (you can found it here) and that was it.

Someone can find this thread very helpful.

Thanks anyway!

@tinnocente
Copy link

Updated Python: Python 2.7.11 (default, Apr 27 2016, 15:42:44)

Producing the same build error. Must be something with my environment. Appreciate any ideas.

npm-debug (2).txt

@stephenwvickers
Copy link
Collaborator

I would suggest checking out the git repo for raw-socket (this is what is failing to build), and try to build by hand, e.g.:

git clone https://github.com/stephenwvickers/node-raw-socket.git
cd node-raw-socket
node-gyp configure
node-gyp build

Sometimes I find npm hides build errors, this should reveal them.

@al095660
Copy link

@tinnocente Try to use the latest version of node and npm. As i can see in the log file, you've installed the node version 5.10.1 and the npm version 3.8.3 (node version 5.11.0 and npm version 3.8.6 are already available). If that fails, try to do what @stephenwvickers says.

@stephenwvickers
Copy link
Collaborator

I've also found in the past upgrades of the node binary may result in node-gyp build failures where globally installed modules need to be upgraded (I have no data to back this up).

Upgrading the Visual Studio version after installing node may also cause you an issue (passing "--msvs_version=..." at the command prompt can help here).

@dimonnwc3
Copy link

dimonnwc3 commented May 10, 2016

Problem is in raw-socket dependency. There is "nan": "2.0.*" dependency in package.json, but it's old version don't work in node 6.

I have manually change nan version in raw-sockets dependency from "nan": "2.0." to "nan": "2.3."
then: npm i
and build: node-gyp configure
node-gyp build

or you can use modified raw-socket version: git clone git@github.com:dimonnwc3/node-raw-socket.git

EDIT: raw-socket updated

Now we can put working raw-socket in this package and it will work fine.

@tinnocente
Copy link

@dimonnwc3 brilliant! that worked. Should update npm registry with correct version of raw-socket. Thanks (all) for your help.

@stephenwvickers
Copy link
Collaborator

Version 1.5.0 of raw-socket has been published to npm

guymguym added a commit to guymguym/node-gyp that referenced this issue Nov 13, 2016
To make sure platform specific newlines ('\r\n' or '\r') are converted to '\n' which otherwise will fail eval().

This should handle multiple issues reported on syntax error reading binding.gyp (partial list):
nodejs#979
nodejs#199
nospaceships/node-net-ping#24
nospaceships/node-net-ping#21
mathiask88/node-snap7#11
node-hid/node-hid#28
xdenser/node-firebird-libfbclient#24
bnoordhuis pushed a commit to nodejs/node-gyp that referenced this issue Nov 16, 2016
To make sure platform specific newlines ('\r\n' or '\r') are converted
to '\n' which otherwise will fail eval().

This should handle multiple issues reported on syntax error reading
binding.gyp (partial list):

#979
#199
nospaceships/node-net-ping#24
nospaceships/node-net-ping#21
mathiask88/node-snap7#11
node-hid/node-hid#28
xdenser/node-firebird-libfbclient#24

PR-URL: #1053
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
refack pushed a commit to refack/node-gyp that referenced this issue Apr 23, 2017
To make sure platform specific newlines ('\r\n' or '\r') are converted
to '\n' which otherwise will fail eval().

This should handle multiple issues reported on syntax error reading
binding.gyp (partial list):

nodejs#979
nodejs#199
nospaceships/node-net-ping#24
nospaceships/node-net-ping#21
mathiask88/node-snap7#11
node-hid/node-hid#28
xdenser/node-firebird-libfbclient#24

PR-URL: nodejs#1053
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
refack pushed a commit to refack/node-gyp that referenced this issue Aug 19, 2017
To make sure platform specific newlines ('\r\n' or '\r') are converted
to '\n' which otherwise will fail eval().

This should handle multiple issues reported on syntax error reading
binding.gyp (partial list):

nodejs#979
nodejs#199
nospaceships/node-net-ping#24
nospaceships/node-net-ping#21
mathiask88/node-snap7#11
node-hid/node-hid#28
xdenser/node-firebird-libfbclient#24

PR-URL: nodejs#1053
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@sourabhjha1993
Copy link

net-ping is not working with node.js version 12.18.1. Does anybody has any solution?

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

6 participants