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

Failed at the x509@0.3.2 install script 'node-gyp rebuild' #49

Open
ashergarland opened this issue Apr 14, 2017 · 16 comments
Open

Failed at the x509@0.3.2 install script 'node-gyp rebuild' #49

ashergarland opened this issue Apr 14, 2017 · 16 comments

Comments

@ashergarland
Copy link

My machine settings:
Windows 10
npm -v // 4.5.0
node -v // 6.10.0

'npm install x509' fail to complete with the error:

LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib\libeay32.lib' [C:\git\test\node_modules\x509\b
uild\x509.vcxproj]

Failed at the x509@0.3.2 install script 'node-gyp rebuild'.

@kalpeshshirodker
Copy link

I am facing same issue. Any progress on this?

@Southern
Copy link
Owner

Sorry guys. Just changed jobs not too long ago and haven't had much time to keep up with this.

As for this error, I can't really say since I don't have a Windows computer to test the compilation with. Do you have OpenSSL installed to C:\OpenSSL-Win64?

@oreporan
Copy link

oreporan commented Jun 7, 2017

Getting the same issue on Linux Docker

@Botffy
Copy link

Botffy commented Jun 27, 2017

That OpenSSL-Win64 path comes from the 28th line of the binding.,gyp. That sucks, and makes this (and everything depending on this) unusable on Windows.

Edit: ah, sorry about being snarky, now I see where that path is coming from. A notice in the Readme would be appreciated, though.

For anyone looking for a solution, see: https://stackoverflow.com/a/39270114/477453
That is, get OpenSSL for Windows, version 1.0.2, from http://slproweb.com/products/Win32OpenSSL.html , and install it in the directory the installer suggests. And that's it, it will compile correctly, woooo.

@bertrandszoghy
Copy link

Am getting the same on CentOS 7.3
[root@centos7 ~]# npm install -g x509

x509@0.3.2 install /usr/lib/node_modules/x509
node-gyp rebuild

gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 3.10.0-514.26.2.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/x509
gyp ERR! node -v v6.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! x509@0.3.2 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the x509@0.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-07-19T16_15_49_944Z-debug.log
[root@centos7 ~]#

@Southern
Copy link
Owner

@Botffy no problem (re: snark). Mind opening a PR to modify the README since you have a Windows machine and know the steps that you had to take to get it working?

@bertrandszoghy your problem is a permission issue on your CentOS system. Check the output that you sent and you can see gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'. You would need to file a node-gyp issue for that.

@oreporan you can't be having this same Windows issue on a Linux container. What is the actual issue that you're running into?

@kalpeshshirodker do you have OpenSSL installed to C:\OpenSSL-Win64?

@bertrandszoghy
Copy link

bertrandszoghy commented Jul 21, 2017 via email

@Southern
Copy link
Owner

@bertrandszoghy no problem. I would still file an issue with node-gyp. Seeing as how you were doing the install as root, there should be no reason for you to be denied removing a directory. Something is definitely off there.

@vognition
Copy link

Hi,

I'm getting a similar error on Debian.
I have been using this package on Centos with an early version of node. It works great.
I'm trying to upgrade my system and your latest packages don't work to install.

I've followed instructions use this:
npm install -g node-gyp
npm install

With the latest version of node for the package I was using x509@0.2.4 and x509@0.3.2 it doesn't work to install.

Can you please fix this build issue, or supply the configuration you are using to test your current x509 package, or supply work around instructions?

Thank you in advance.

Error:

x509@0.3.2 install /opt/nodetest/node_modules/x509
node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.2.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/opt/nodetest/node_modules/x509/.node-gyp"
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.9.0-3-amd64
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/vogamazonecho/node_modules/x509
gyp ERR! node -v v8.2.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! x509@0.3.2 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the x509@0.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-08-14T16_02_53_853Z-debug.log

@Botffy
Copy link

Botffy commented Aug 14, 2017

@vognition
"gyp ERR! stack Error: not found: make" Well, do you have make? It's in the build-essential package, iirc.

@vognition
Copy link

vognition commented Aug 14, 2017

@Botffy Thanks. This is a new vm server installation. A few hands are on it. I thought the machine had that stuff installed already, but I guess not.

@jasonblanchard
Copy link

I'm getting a similar error trying to deploy an application with Elastic Beanstalk using x509 v0.3.2 with node v8.1.4 (npm v5.0.3):

Application deployment failed at 2017-09-25T16:04:21Z with exit status 1 and error: Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh failed.

+ /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install

> x509@0.3.2 install /tmp/deployment/application/node_modules/x509
> node-gyp rebuild

gyp ERR! clean error 
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Linux 4.9.43-17.38.amzn1.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.1.4-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v8.1.4-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/deployment/application/node_modules/x509
gyp ERR! node -v v8.1.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! x509@0.3.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the x509@0.3.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /tmp/.npm/_logs/2017-09-25T16_04_21_152Z-debug.log
Running npm install: /opt/elasticbeanstalk/node-install/node-v8.1.4-linux-x64/bin/npm
Setting npm config jobs to 1
npm config jobs set to 1
Running npm with --production flag
Failed to run npm install. Snapshot logs for more details.
UTC 2017/09/25 16:04:21 cannot find application npm debug log at /tmp/deployment/application/npm-debug.log 

Traceback (most recent call last):
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 695, in <module>
main()
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
node_version_manager.run_npm_install(options.app_path)
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, in run_npm_install
self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 180, in npm_install
raise e
subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v8.1.4-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1.

Works fine locally on OS X. I tried all the hack-arounds from this thread, but no luck.

Seems like a node-gyp issue, but any insights? Admittedly, I do not really know how node-gyp works or is supposed to work. I don't really want to mess around with EB's base AMI permissions 🤒

@Botffy
Copy link

Botffy commented Sep 26, 2017

@jasonblanchard The line gyp ERR! stack Error: EACCES: permission denied, rmdir 'build' is pretty clear: the npm stack does not have permission to delete the build directory. Probably a different user runs the npm install, not the one who owns your application directory. I don't know much about EB, but there's this issue which sounds kinda similar.

@jasonblanchard
Copy link

@Botffy Yup, agreed. After digging pretty deep into the EB deploy script, it appears to be running npm install as root and then switching to a different user context to run the package scripts, which I think is actually default npm behavior when running as root. We've submitted a ticket to AWS with steps to reproduce and they've acknowledged that they can reproduce it and forwarded the issue to their EB team. I'll post back here if they tell us anything useful.

In the meantime, the deploy works if you use the npm unsafe-perm option, which I don't feel particularly comfortable with since it seems unsafe (hence the name, I assume).

I also found a similar sounding issue with the farmhash library and it looks like they solved it by shipping the package with pre-compiled binaries, so that could be an option for node-x509 if other people are hitting this pain point.

@jasonblanchard
Copy link

Heard back from AWS support and it sounds like this is actually an NPM 5 regression. Here are some relevant issues:

For now, using the unsafe-perm option is the recommended work-around, but EB will release a new base AMI when there is a patch in for this NPM issue.

@nhalstead
Copy link

I have found a solution to @ashergarland's original issue as I too have had this issue.
For Windows installing OpenSSL Version 1.1.0k, the libs were renamed from the libeay32.lib to libcrypto.dll. So the simple solution to this is to make an symbolic link using mklink in Windows. Tested on Windows 10 with Node Version 10.13.0.

Start CMD as Administrator

cd /d C:\OpenSSL-Win64\lib
mklink libeay32.lib libcrypto.lib

Output should match symbolic link created for libcrypto32.lib <<===>> libcrypto.lib
I have done that and was building with no further issues with x509.

You can find a thread related to the file rename on StackOverflow

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

9 participants