nodejs / node-gyp

Node.js native addon build tool
MIT License
9.94k stars 1.8k forks source link

node-gyp rebuild error #2191

Closed ishanuda closed 4 years ago

ishanuda commented 4 years ago

Hi, I have an application on the Windows desktop env. configured running node-gyp without errors My desktop env is:

windows 10 (os build 18363.959) - 64bit using Node Package Manager (nvm) v1.1.7 node v10.16.3 node-gyp v5.0.7 python v3.8.0 also in npmrc file refered to the following: python=D:\Program Files\Python\Python27\python.exe

MSVS 2015 - Professional Ed MSVS 2019 - Community Ed

windows-build-tools@5.2.2

But when I try to install the dependency for the same application on my laptop by running npm i it fails with the node-gyp rebuild error:

My laptop env is:

windows 10 (os build 19041.388) - 64bit using Node Package Manager (nvm) v1.1.7 node v10.16.3 node-gyp v7.0.0 python v2.7.3

MSVS 2015 - Community Ed MSVS 2019 - Community Ed

windows-build-tools@5.2.2

NOTE: I tried to configure with the same configurations as my desktop, also followed many references. but the situation is the same. Could not get to fix the problem.

I also tried installing only build tools, also only installing MSVS 2015 but the result is the same.

Error is as follows:

node-gyp-error

Any recommendations would be appreciated.

Thank you very much.

cclauss commented 4 years ago

Python v2.7.3 -> v2.7.18 or v3.8.5 sounds like a good place to start. ERR! node-gyp v3.8.0 in the log output is not a good sign.

cclauss commented 4 years ago

https://github.com/nodejs/node-gyp/pull/1762 Landed in Node-gyp v5.

Please try npm install -g npm or the equivalent Windows commands.

username1565 commented 4 years ago

Try to rebuild the node-gyp, on Windows 8.1 x64, with NodeJS v12.3.1, but get the same failure: This wants Visual Studio 2017, but this can not be installed: https://github.com/justmoon/node-bignum/issues/121#issuecomment-671322395 Nees some workaround, because everything else works.

cclauss commented 4 years ago

Did you upgrade npm? What does log say after that?

username1565 commented 4 years ago

@cclauss, there the same log, like here: https://github.com/justmoon/node-bignum/issues/121#issuecomment-671818205 after npm upgrade try to run the command node-gyp rebuild.

ishanuda commented 4 years ago

Hi, also I tried installing the following configurations and gives the same error.

windows 10 (os build 18363.959) - 64bit using Node Package Manager (nvm) v1.1.7 node v10.16.3 node-gyp v7.1.0 python v3.8.0 also in npmrc file refered to the following: python=D:\Program Files\Python\Python28\python.exe

MSVS 2015 - Professional Ed MSVS 2019 - Community Ed

windows-build-tools@5.2.2

regards.

ctolkien commented 4 years ago

I believe I'm hitting the same issue.

gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.19041
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\chad\source\Foo\node_modules\ttf2woff2
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

Looking at the build error logs:

error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments

Does this indicate the version of node running is not compatible with this version of node-gyp? I could not find a compatibility table.

cclauss commented 4 years ago

It is unclear what command you typed and the full error log is missing. The label on this issue should be a clue that gyp ERR! node-gyp -v v5.0.5 is a problem. The current node-gyp is v7.1.

Please try npm install -g npm or the equivalent Windows commands.

SailingSteve commented 4 years ago

@cclauss "Please try npm install -g npm or the equivalent Windows commands." worked for me!

on MacOS 10.15.5

sudo npm install -g npm

did it Thanks!

water-in-stone commented 3 years ago

try npm install -g node-gyp

ShahriarKh commented 3 years ago

npm upgrade worked for me.

priyanshdas commented 3 years ago

This occurs after i installed NodeV16 with Latest Npm Version

npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@16.6.1 | win32 | ia32
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
npm ERR! gyp info spawn args   '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args   '/nologo',
npm ERR! gyp info spawn args   '/p:Configuration=Release;Platform=Win32'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\Priyansh Das\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Priyansh Das\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\Priyansh Das\\Desktop\\E BOT rewrite\\node_modules\\@discordjs\\opus\\prebuild\\node-v93-napi-v3-win32-ia32-unknown-unknown\\opus.node" "--module_name=opus" "--module_path=C:\\Users\\Priyansh Das\\Desktop\\E BOT rewrite\\node_modules\\@discordjs\\opus\\prebuild\\node-v93-napi-v3-win32-ia32-unknown-unknown" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd C:\Users\Priyansh Das\Desktop\E BOT rewrite\node_modules\@discordjs\opus
npm ERR! gyp ERR! node -v v16.6.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Users\Priyansh Das\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\Priyansh Das\Desktop\E BOT rewrite\node_modules\@discordjs\opus\prebuild\node-v93-napi-v3-win32-ia32-unknown-unknown\opus.node --module_name=opus --module_path=C:\Users\Priyansh Das\Desktop\E BOT rewrite\node_modules\@discordjs\opus\prebuild\node-v93-napi-v3-win32-ia32-unknown-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Priyansh Das\Desktop\E BOT rewrite\node_modules\@discordjs\node-pre-gyp\lib\util\compile.js:85:20)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1067:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19042
npm ERR! node-pre-gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Priyansh Das\\Desktop\\E BOT rewrite\\node_modules\\@discordjs\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\Priyansh Das\Desktop\E BOT rewrite\node_modules\@discordjs\opus
npm ERR! node-pre-gyp ERR! node -v v16.6.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.4.0
npm ERR! node-pre-gyp ERR! not ok

I tried npm i -g npm and rebuilt after npm update but still same

Is this error common with nodeV16?

robozb commented 2 years ago

Same problem here :(

npm WARN deprecated natives@1.1.6: This module relies on Node.js's internals and will break at some point. Do not use it, and update to graceful-fs@4.x.
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated gulp-header@1.8.9: Removed event-stream from gulp-header
npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated formidable@1.0.17: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@4.2.1: this library is no longer supported
npm WARN deprecated express@2.5.11: express 2.x series is deprecated
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated connect@1.9.2: connect 1.x series is deprecated
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher\\node_modules',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\glob-watcher\node_modules\globule\test\fixtures\expand\deep'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher\\node_modules\\globule\\test\\fixtures\\expand\\deep'
npm WARN cleanup     }
npm WARN cleanup   ],
npm WARN cleanup   [
npm WARN cleanup     'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\glob-watcher\node_modules\globule\test\fixtures\expand\deep'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\glob-watcher\\node_modules\\globule\\test\\fixtures\\expand\\deep'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@18.12.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:207:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python311\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:412:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:449:11)
npm ERR! gyp ERR! stack     at Socket.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:313:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "I:\\Kivitelezes\\PeterBurgerEU\\Tarhely\\gulpteszt\\resume-bootstrap4-master\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd I:\Kivitelezes\PeterBurgerEU\Tarhely\gulpteszt\resume-bootstrap4-master\node_modules\node-sass
npm ERR! gyp ERR! node -v v18.12.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Beci\AppData\Local\npm-cache\_logs\2022-11-10T16_25_40_106Z-debug-0.log
epomatti commented 1 year ago

I was running an old app on Node 18 and was getting this issue.

Figured I needed Node 14, so the following did it for me:

nvm install 14
nvm use 14