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

Couldn't install the module. #24

Closed
guhanc opened this issue May 27, 2016 · 31 comments
Closed

Couldn't install the module. #24

guhanc opened this issue May 27, 2016 · 31 comments

Comments

@guhanc
Copy link

guhanc commented May 27, 2016

i am using node verison 6.2.0 and my npm version 3.8.9 . And i am trying to install this module in centos 6.7. But i am getting the following error.

(node:11106) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.

[email protected] install /root/services/fieldorder/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
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:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Linux 2.6.32-573.12.1.el6.x86_64
gyp ERR! command "/usr/local/n/versions/node/6.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/services/fieldorder/node_modules/raw-socket
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 2.6.32-573.12.1.el6.x86_64
npm ERR! argv "/usr/local/n/versions/node/6.2.0/bin/node" "/usr/local/bin/npm" "install" "net-ping"
npm ERR! node v6.2.0
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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/services/fieldorder/npm-debug.log

But i am able to install on my mac which is using the same verison of node and npm.

@stephenwvickers
Copy link
Collaborator

What version of Python and node-gyp are you using?

@dwumpus
Copy link

dwumpus commented Jun 16, 2016

same issue

@crisryantan
Copy link

also experiencing this

@Modzor13
Copy link

Having the same problem as well.

@dwumpus
Copy link

dwumpus commented Jun 18, 2016

fixed mine by uninstalling python 3.6 or whatever and reinstalling python 2.7.

@stephenwvickers
Copy link
Collaborator

This issue is normally experience for 1 of 2 reasons. Either not using Python 2.7 or an upgrade to either node.js or Visual Studio on Windows.

Does anyone experiencing this issue not fall under this?

I have testing on a clean Linux install using the quote npm and node.js version and it works for me.

@robrichard
Copy link

I can reproduce this problem with linux and python < 3.0

# npm --version
2.15.6
# node --version
v4.4.5
# node-gyp --version
v0.10.6
# python --version
Python 2.6.6

npm-debug.log.txt

@stephenwvickers
Copy link
Collaborator

I've only ever used Python 2.7, so I can't be sure if 2.6 will work.

Can you checkout the repo manually and see if you can build it, if not we should see some more useful output from node-gyp:

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

The raw-socket module is where the problem is, this is used by net-ping.

Thanks

Steve

@BilalBoulifa
Copy link

I'm facing the same issue

@stephenwvickers
Copy link
Collaborator

Hi,

Can you try the steps I gave in my recent comment:

#24 (comment)

Thanks

Steve

@Franzinator
Copy link

Same issue on Ubuntu 11.04 (natty). npm-debug.txt

$ node --version
v6.4.0
$ npm --version
3.10.6
$ node-gyp --version
v3.4.0
$ python --version
Python 2.7.1+

Executing node-gyp configure in node-raw-socket works fine (ends with ok).

Executingnode-gyp build on the other hand:

$ Error: `make` failed with exit code: 2
$ at ChildProcess.onExit (/home/franz/.nvm/versions/node/v6.4.0/lib/node_modules/node-gyp/lib/build.js:276:23)
$ at emitTwo (events.js:106:13)
$ at ChildProcess.emit (events.js:191:7)
$ at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)

Here is the full log: log.txt

@stephenwvickers
Copy link
Collaborator

Hi @Franzinator

Looking at the top of the log file you can see:

In file included from ../src/raw.h:23:0,
                 from ../src/raw.cc:6:
../node_modules/nan/nan.h:43:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from /home/franz/.node-gyp/6.4.0/include/node/node.h:42:0,
                 from ../src/raw.h:21,
                 from ../src/raw.cc:6:

Specifically the message "This version of node/NAN/v8 requires a C++11 compiler".

Steve

@stephenwvickers
Copy link
Collaborator

Has anyone been able to performed an installation of node-raw-socket from GitHub like @Franzinator.

Looking at his debug log NAN is complaining about the compiler not supporting C++11, and I wondered if other people are experiencing the same issue.

Please do let me know.

@cryoW0lf
Copy link

cryoW0lf commented Sep 5, 2016

I build from github on my own pc, and it worked, but i'm new to node, so i can't use it right :D

@sequoiar
Copy link

try upgrade to gcc/g++ 4.8

@NimrodGeva
Copy link

Hi @stephenwvickers,
Had the same issue.
node-gyp was complaining about binding.gyp so I opened it with vi, and I happened to notice it was encoded as DOS.
I used dos2unix on binding.gyp which solved the issue.
No clue as to how this could happen. Would this be expected if raw-socket was published to npm through a win machine?
When looking at the source code in git-hub it seemed fine.

@stephenwvickers
Copy link
Collaborator

Hi, it is possible a Windows host was used, however I've nevered experienced the issue you described before, I certainly don't see it on my Ubuntu host.

What platform, compiler, Python, node, node-gyp and npm versions are you using?

Also, does this solution work for anyone else?

@NimrodGeva
Copy link

I didn't encounter any issues on my OS X machine. The problem was reproduced on two different CentOS 6.8 machines, with the following configurations:
node v4.4.4, npm v2.15.1, node-gyp 3.4.0
node v6.9.1, npm v3.10.8, same node-gyp.
It was also on very old node and npm versions before that.

I Just tried on an Ubuntu 14, node v7.0.0, npm v3.10.8, same node-gyp.
Behavior was a bit different. Install still fails when trying to npm install the package. The errors are a bit different.
node-raw-socket_ root_osboxes___ ssh_osboxes_192_168_100_128 _157x40

In any case, when downloading the tarball and running 'node-gyp rebuild' the issue reproduces.
I would have submitted a PR on raw-socket to eliminate the carriage returns on binding.gyp, but when going through git-hub and looking at it the CRs don't seem to be there.

@stephenwvickers
Copy link
Collaborator

I will publish another version later tonight (UK time) - I will update this issue once I have done this.

If you could then test with the new package and let me if it resolved the issue for you.

Cheers

Steve

@NimrodGeva
Copy link

Thanks @stephenwvickers!
Please ping me when you get around to it. :)

@stephenwvickers
Copy link
Collaborator

Hi @NimrodGeva

So, I've done some testing and I cannot reproduce the issue:

[root@gitlab-runner net-ping-test]# ls -l
total 0
[root@gitlab-runner net-ping-test]# node -v
v6.9.1
[root@gitlab-runner net-ping-test]# npm -v
3.10.8
[root@gitlab-runner net-ping-test]# npm install net-ping

> raw-socket@1.5.0 install /home/stephen/projects/net-ping-test/node_modules/raw-socket
> node-gyp rebuild

make: Entering directory `/home/stephen/projects/net-ping-test/node_modules/raw-socket/build'
  CXX(target) Release/obj.target/raw/src/raw.o
  ...
  SOLINK_MODULE(target) Release/obj.target/raw.node
  COPY Release/raw.node
make: Leaving directory `/home/stephen/projects/net-ping-test/node_modules/raw-socket/build'
/home/stephen/projects/net-ping-test
└─┬ [email protected]
  └─┬ [email protected]
    └── [email protected]

npm WARN enoent ENOENT: no such file or directory, open '/home/stephen/projects/net-ping-test/package.json'
npm WARN net-ping-test No description
npm WARN net-ping-test No repository field.
npm WARN net-ping-test No README data
npm WARN net-ping-test No license field.
[root@gitlab-runner net-ping-test]# ls -l
total 0
drwxr-xr-x. 5 root root 48 Nov  8 20:43 node_modules
[root@gitlab-runner net-ping-test]# cd node_modules/net-ping/
[root@gitlab-runner net-ping]#
[root@gitlab-runner net-ping]# node example/trace-route 10 8.8.8.8
8.8.8.8: 192.168.1.254 (ttl=1 ms=2)
8.8.8.8: RequestTimedOutError: Request timed out (ttl=2 ms=4007)
8.8.8.8: RequestTimedOutError: Request timed out (ttl=3 ms=4006)
8.8.8.8: 31.55.187.184 (ttl=4 ms=8)
8.8.8.8: 195.99.127.26 (ttl=5 ms=7)
8.8.8.8: 195.99.127.3 (ttl=6 ms=7)
8.8.8.8: 195.99.126.105 (ttl=7 ms=7)
8.8.8.8: 216.239.48.113 (ttl=8 ms=8)
8.8.8.8: 216.239.58.95 (ttl=9 ms=9)
8.8.8.8: 8.8.8.8 (ttl=10 ms=10)
8.8.8.8: Done
[root@gitlab-runner net-ping]#

So, I think your issue is not related to line endings in the source.

Steve

@NimrodGeva
Copy link

Hi @stephenwvickers
Have you not been able to reproduce the issue at all?
As of right now I have not been able to install the package on the following distros:
CentOS 7, CentOS 6.8, Ubuntu 14 and Ubuntu 16.
On what environment did you successfully install?
Nimrod

@stephenwvickers
Copy link
Collaborator

What is your python version?

python -V

@NimrodGeva
Copy link

Python 2.7.6

@NimrodGeva
Copy link

This looks like a similar issue: fuwaneko/node-protobuf#8

@stephenwvickers
Copy link
Collaborator

Hi @NimrodGeva

I have not been able to recreate this issue.

Can you recreate the issue and post the npm-debug.log file, as well as the console output, from download the repo and using node-gyp configure/install to install manually.

Steve

@sequoiar
Copy link

sequoiar commented Nov 11, 2016

@rguhanc
try to upgrade gcc/g++ to 3.8 or above

@guymguym
Copy link

Hi @stephenwvickers

The reason for this failure is that python (used by node-gyp) is throwing a syntax error while trying to eval() the binding.gyp file with dos file endings (\r\n).
You can check if your version of python will fail on it using this command: python -c 'eval("{\r\n}")'

> python -c 'eval("{\r\n}")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1
    {
    ^
SyntaxError: invalid syntax

> python -V
Python 2.6.6

Found similar issues with this google query "invalid syntax binding.gyp line 1":
#21
mathiask88/node-snap7#11
node-hid/node-hid#28
xdenser/node-firebird-libfbclient#24
nodejs/node-gyp#979
nodejs/node-gyp#199

In some cases upgrading to python version >=2.7.3 solved it, which makes some sense as it might be when python eval was changed to accept \r\n as newlines.
However the weird thing is that in some cases even using new python 2.7 did not help.
I think maybe to send a PR to fix this in node-gyp code -
https://github.com/nodejs/node-gyp/blob/master/gyp/pylib/gyp/input.py#L233
Like this:

    build_file_contents = open(build_file_path).read().replace('\r\n', '\n')

But not sure it will be accepted without an explanation of why it is needed for new python.

@NimrodGeva I really wonder why it fails for you on python 2.7 - can you try the short python command I wrote above?

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
@stephenwvickers
Copy link
Collaborator

I've published a new version of raw-socket to npm, please give this a try.

The raw-socket issue for this change is:

nospaceships/node-raw-socket#23

@NimrodGeva
Copy link

Checked on a CentOS 6 machine, it seems to have done the trick. Thanks!

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 <[email protected]>
@stephenwvickers
Copy link
Collaborator

@NimrodGeva confirmed new version of raw-socket resolved the issue.

Also, I see a change has been made in node-gyp to handle windows style line endings.

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 <[email protected]>
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 <[email protected]>
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