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

Build fails on non-root linux user #11

Closed
teropes opened this issue Oct 19, 2015 · 7 comments
Closed

Build fails on non-root linux user #11

teropes opened this issue Oct 19, 2015 · 7 comments

Comments

@teropes
Copy link

teropes commented Oct 19, 2015

I'm getting the following build error when installing node-snap7. Im operating on Centos 6 and trying to install as non-root user. Running on node 0.12.7, also tried with 0.10.40. Installing as root works. Is there any way to avoid installing this package as root?

node-gyp rebuild
Traceback (most recent call last):
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in
sys.exit(gyp.script_main())
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 533, in script_main
return main(sys.argv[1:])
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 526, in main
return gyp_main(args)
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 502, in gyp_main
params, options.check, options.circular_check)
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 129, in Load
params['parallel'], params['root_targets'])
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2736, in Load
variables, includes, depth, check, True)
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 386, in LoadTargetBuildFile
includes, True, check)
File "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 238, 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/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:355:16)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 2.6.32-504.30.3.el6.x86_64
gyp ERR! command "node" "/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /data/my-project/node_modules/node-snap7
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Linux 2.6.32-504.30.3.el6.x86_64
npm ERR! argv "/home/sysuser/.nvm/versions/node/v0.12.7/bin/node" "/home/sysuser/.nvm/versions/node/v0.12.7/bin/npm" "install" "node-snap7"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! node-snap7@0.2.1 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-snap7@0.2.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node-snap7 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 their info via:
npm ERR! npm owner ls node-snap7
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /data/my-project/npm-debug.log

@mathiask88
Copy link
Owner

Hi, sry for the late response. Can you check your python version that is installed for the non-root user? 2.7.3 or newer(not 3.x) is necessary for node-gyp.

@teropes
Copy link
Author

teropes commented Oct 20, 2015

python --version outputs 2.7.8. My /usr/local/bin/python is symlink to /usr/local/bin/python2.7 and I havent got issues with building other packages in this project such as oracledb. I also tried with my other development machine which runs Oracle Linux 6.5 and got same issue there.

Here is my npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/home/sysuser/.nvm/versions/node/v0.12.7/bin/node',
1 verbose cli '/home/sysuser/.nvm/versions/node/v0.12.7/bin/npm',
1 verbose cli 'rebuild',
1 verbose cli 'node-snap7' ]
2 info using npm@2.11.3
3 info using node@v0.12.7
4 info readInstalled object
5 verbose rebuild path, id [ '/data/my-project/node_modules/node-snap7',
5 verbose rebuild 'node-snap7@0.2.1' ]
6 silly rebuild set [ '/data/my-project/node_modules/node-snap7' ]
7 info build /data/my-project/node_modules/node-snap7
8 info preinstall node-snap7@0.2.1
9 info linkStuff node-snap7@0.2.1
10 silly linkStuff node-snap7@0.2.1 has /data/my-project/node_modules as its parent node_modules
11 verbose linkBins node-snap7@0.2.1
12 verbose linkMans node-snap7@0.2.1
13 verbose rebuildBundles node-snap7@0.2.1
14 verbose rebuildBundles [ 'bindings', 'nan' ]
15 info install node-snap7@0.2.1
16 verbose unsafe-perm in lifecycle true
17 info node-snap7@0.2.1 Failed to exec install script
18 verbose stack Error: node-snap7@0.2.1 install: node-gyp rebuild
18 verbose stack Exit status 1
18 verbose stack at EventEmitter. (/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
18 verbose stack at EventEmitter.emit (events.js:110:17)
18 verbose stack at ChildProcess. (/home/sysuser/.nvm/versions/node/v0.12.7/lib/node_modules/npm/lib/utils/spawn.js:24:14)
18 verbose stack at ChildProcess.emit (events.js:110:17)
18 verbose stack at maybeClose (child_process.js:1015:16)
18 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
19 verbose pkgid node-snap7@0.2.1
20 verbose cwd /data/my-project
21 error Linux 2.6.32-504.30.3.el6.x86_64
22 error argv "/home/sysuser/.nvm/versions/node/v0.12.7/bin/node" "/home/sysuser/.nvm/versions/node/v0.12.7/bin/npm" "rebuild" "node-snap7"
23 error node v0.12.7
24 error npm v2.11.3
25 error code ELIFECYCLE
26 error node-snap7@0.2.1 install: node-gyp rebuild
26 error Exit status 1
27 error Failed at the node-snap7@0.2.1 install script 'node-gyp rebuild'.
27 error This is most likely a problem with the node-snap7 package,
27 error not with npm itself.
27 error Tell the author that this fails on your system:
27 error node-gyp rebuild
27 error You can get their info via:
27 error npm owner ls node-snap7
27 error There is likely additional logging output above.
28 verbose exit [ 1, true ]

@mathiask88
Copy link
Owner

Can you check if the binding.gyp contains CRLF or LF line endings? I'm on my phone right now. I'm developing under Windows and maybe the CRLF slipped in.

@teropes
Copy link
Author

teropes commented Oct 20, 2015

My text editor on my dev machine (Sublime Text 3) shows Line Endings as "Windows" so that may indeed be the issue.

@mathiask88
Copy link
Owner

Yes, there is something wrong indeed. On Github line endings are ok because of git's autoCRLF I think but npm uploaded the DOS/Windows line endings :( I'm about to release a new version anyway and will have a special look on LE this time. You can try install from github (e.g. npm install mathiask88/node-snap7) or wait until the new version is published. Thanks for your report!

@mathiask88
Copy link
Owner

@teropes I published a new release to npm that fixed the line endings and is compatible to node 4.x. Would be cool if you can test it and report back.

@teropes
Copy link
Author

teropes commented Oct 21, 2015

node-snap7 0.2.2 now builds properly also as non-root user in both of my Centos / Oracle Linux dev machines and no other issues detected so far. This is now fixed, cheers!

@teropes teropes closed this as completed Oct 21, 2015
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>
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

2 participants