node-argon2: Cannot install argon2 on windows 10

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 node-gyp@3.8.0
gyp info using node@10.14.1 | 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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 21 (6 by maintainers)

Most upvoted comments

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 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 argon2@0.19.3.

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

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

v0.20.1 is live.

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.

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