node-argon2 icon indicating copy to clipboard operation
node-argon2 copied to clipboard

Cannot install argon2 on windows 10

Open vimutti77 opened this issue 8 years ago • 21 comments

Steps to reproduce

  1. yarn add argon2

Expected behaviour

The package is installed correctly,

Actual behaviour

The build of argon2 v0.20.0 binary fails with following errors:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp http GET https://nodejs.org/download/release/v10.14.1/node-v10.14.1-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.14.1/node-v10.14.1-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v10.14.1/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v10.14.1/win-x86/node.lib
gyp http GET https://nodejs.org/download/release/v10.14.1/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v10.14.1/win-x86/node.lib
gyp http 200 https://nodejs.org/download/release/v10.14.1/win-x64/node.lib
gyp http 200 https://nodejs.org/download/release/v10.14.1/SHASUMS256.txt
gyp info spawn C:\Users\xxx\.windows-build-tools\python27\python.EXE
gyp info spawn args [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Users\\xxx\\node_modules\\argon2\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\xxx\\.node-gyp\\10.14.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\xxx\\.node-gyp\\10.14.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\xxx\\.node-gyp\\10.14.1\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\Users\\xxx\\node_modules\\argon2',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\Users\\xxx\\node_modules\\argon2\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: Dependency 'binding.gyp:require(node-addon-api).gyp#target' not found while trying to load target binding.gyp:argon2#target
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Users\xxx\node_modules\argon2
gyp ERR! node -v v10.14.1
gyp ERR! node-gyp -v v3.8.0

Environment

Operating system: windows 10 v1809

Node version:: 10.14.1

Compiler version:: lastest windows-build-tools. using powershell on vscode v1.29.1

vimutti77 avatar Dec 04 '18 14:12 vimutti77

I see the same issue is happening with AppVeyor builds. Looking to fix it.

ranisalt avatar Dec 04 '18 15:12 ranisalt

Same problem here on a windows 10 machine with node v10.11.0 installed. Try to install argon ^0.20.0

mfechner avatar Dec 13 '18 12:12 mfechner

Hi,

Same problem on Windows 10. Version 0.19.3 work well !

Best Regards, Irvin

Captainfive avatar Dec 13 '18 15:12 Captainfive

@Captainfive thanks for this tip, installed now to 0.19.3 and it works.

mfechner avatar Dec 13 '18 18:12 mfechner

Just added info - it works fine on node v8. Fails on node v10.

jdforsythe avatar Jan 03 '19 21:01 jdforsythe

@ranisalt I confirm that it's not working with the latest argon2 (0.20.0) on Windows 10 using node 11.6.0, it only works on version [email protected].

theprobugmaker avatar Jan 11 '19 00:01 theprobugmaker

I'm pretty sure this is being caused by the submodule phc-winner-argon2 not loading. If I clone and manually place that submodule in the argon2 directory it builds fine with latest version on windows 10. I'm not knowledgeable with using git submodules though if anyone knows how to fix this?

weagle08 avatar Jan 25 '19 02:01 weagle08

I also had to modify the binding.gyp line 57:

"dependencies": ["<!(node -p 'require(\"node-addon-api\").gyp')", "libargon2"]

to

"dependencies": ["libargon2"]

not exactly sure what the ('node-addon-api').gyp is doing.

weagle08 avatar Jan 25 '19 03:01 weagle08

can anyone help with the submodule issue?

weagle08 avatar Jan 28 '19 01:01 weagle08

You need to clone with git clone --recursive, but it shouldn't be an issue when installing from npm/yarn as the files are already included.

not exactly sure what the ('node-addon-api').gyp is doing.

It provides interfacing with Node internals, as this module needs, to provide JS bindings.

ranisalt avatar Jan 28 '19 16:01 ranisalt

Having the same problem on node v11.8.0. I can't install the latest version of argon2, but I can install version 0.19.3.

ghost avatar Jan 28 '19 16:01 ghost

I was able to fix this myself on Node.js v11.8.0.

  • Download this repo
  • Download https://github.com/P-H-C/phc-winner-argon2
  • Apply https://github.com/ranisalt/node-argon2/issues/153#issuecomment-457438557
  • Extract this repo and put /src and /include from PHC Argon2 into this repo's /argon2 folder
  • npm install inside this repo's folder

ghost avatar Jan 28 '19 17:01 ghost

not exactly sure what the ('node-addon-api').gyp is doing.

Dropping it from the configuration does seem to fix builds on Windows while not breaking Linux/Mac builds, which is optimal.

ranisalt avatar Jan 28 '19 17:01 ranisalt

v0.20.1 is live.

ranisalt avatar Jan 28 '19 17:01 ranisalt

Build went successful for me 🎉

ghost avatar Jan 28 '19 17:01 ghost

thanks guys!

weagle08 avatar Jan 28 '19 18:01 weagle08

Also would not build if version of python was > 2.7. I had version 3.7.2 and had to remove the environmental path to it leaving only the path to 2.7 This error occurred with versions 0.19.3 AND 0.20.1. Checked it twice to be sure.

gyp ERR! stack Error: Command failed: C:\python\3.7.2\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:299:12)
gyp ERR! stack     at ChildProcess.emit (events.js:193:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:999:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\greg_\Documents\tech-stack-starter\node_modules\argon2
gyp ERR! node -v v11.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

gregbown avatar Apr 22 '19 05:04 gregbown

Also would not build if version of python was > 2.7. I had version 3.7.2 and had to remove the environmental path to it leaving only the path to 2.7

This is an issue with node-gyp, to be more precise, an issue with gyp requiring Python 2.7. I intend to move to cmake-js in the near future and kill this issue.

ranisalt avatar Apr 22 '19 07:04 ranisalt

I am also getting the same error, it is working perfectly on windows operating system, but when I am trying to move on " Amazon Linux AMI". It's giving the following error.

python version is 2.7.16 and node v 13.0.1

[email protected] install /node_modules/argon2 node-gyp rebuild

make: Entering directory /node_modules/argon2/build' CC(target) Release/obj.target/libargon2/argon2/src/opt.o make: cc: Command not found make: *** [Release/obj.target/libargon2/argon2/src/opt.o] Error 127 make: Leaving directory /node_modules/argon2/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/home/ec2-user/.nvm/versions/node/v13.0.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Linux 4.14.138-89.102.amzn1.x86_64 gyp ERR! command "/home/ec2-user/.nvm/versions/node/v13.0.1/bin/node" "/home/ec2-user/.nvm/versions/node/v13.0.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /node_modules/argon2 gyp ERR! node -v v13.0.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok npm WARN [email protected] No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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! /home/ec2-user/.npm/_logs/2019-11-05T01_03_05_463Z-debug.log

DigiGroundJohn avatar Nov 05 '19 01:11 DigiGroundJohn

@DigiGroundJohn sudo apt-get install build-essential and you're good to go

banou26 avatar May 09 '20 19:05 banou26