This is the error I am getting while I am trying to run npm install/ npm install nodejs-java on windows 11.
npm version – 9.6.1
node version – v18.15.0
Visual studio – 2017
I tried several times but it’s not working. How can I fix this issue ?
This is required to run a react based application. The same application works fine in mac.
npm ERR! code 1
npm ERR! path C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-java
npm ERR! command failed
npm ERR! command C:Windowssystem32cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR! java.cpp
npm ERR! c:usersstudyclonespring-reactjsfrontendnode_modulesnannan.h(2535): warning C4996: 'v8::ObjectTemplate::SetAccessor': Do signature check in accessor [C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-javabuildnodejavabridge_bindings.vcxproj]
npm ERR! c:usersappdatalocalnode-gypcache18.15.0includenodev8-template.h(838): note: see declaration of 'v8::ObjectTemplate::SetAccessor'
npm ERR! javaObject.cpp
npm ERR! c:usersstudyclonespring-reactjsfrontendnode_modulesnannan.h(2535): warning C4996: 'v8::ObjectTemplate::SetAccessor': Do signature check in accessor [C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-javabuildnodejavabridge_bindings.vcxproj]
npm ERR! c:usersappdatalocalnode-gypcache18.15.0includenodev8-template.h(838): note: see declaration of 'v8::ObjectTemplate::SetAccessor'
npm ERR! javaScope.cpp
npm ERR! methodCallBaton.cpp
npm ERR! c:usersstudyclonespring-reactjsfrontendnode_modulesnannan.h(2535): warning C4996: 'v8::ObjectTemplate::SetAccessor': Do signature check in accessor [C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-javabuildnodejavabridge_bindings.vcxproj]
npm ERR! c:usersappdatalocalnode-gypcache18.15.0includenodev8-template.h(838): note: see declaration of 'v8::ObjectTemplate::SetAccessor'
npm ERR! nodeJavaBridge.cpp
npm ERR! C:UsersStudyclonespring-reactjsfrontendnode_modulesnannan.h(2535): warning C4996: 'v8::ObjectTemplate::SetAccessor': Do signature check in accessor [C:UsersStudy-clone-spring-reactjsfrontendnode_modulesnodejs-javabuildnodejavabridge_bindings.vcxproj]
npm ERR! c:usersappdatalocalnode-gypcache18.15.0includenodev8-template.h(838): note: see declaration of 'v8::ObjectTemplate::SetAccessor'
npm ERR! utils.cpp
npm ERR! c:usersstudy-clone-spring-reactjsfrontendnode_modulesnannan.h(2535): warning C4996: 'v8::ObjectTemplate::SetAccessor': Do signature check in accessor [C:UsersStudy-clone-spring-reactjsfrontendnode_modulesnodejs-javabuildnodejavabridge_bindings.vcxproj]
npm ERR! c:usersappdatalocalnode-gypcache18.15.0includenodev8-template.h(838): note: see declaration of 'v8::ObjectTemplate::SetAccessor'
npm ERR! C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-javasrcutils.cpp(487): error C2039: 'GetContents': is not a member of 'v8::ArrayBuffer' [C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-javabuildnodejavabridge_bindings.vcxproj]
npm ERR! c:usersappdatalocalnode-gypcache18.15.0includenodev8-wasm.h(18): note: see declaration of 'v8::ArrayBuffer'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.10 found at "C:UsersAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0python.exe"
npm ERR! gyp info find VS using VS2017 (15.9.33423.255) found at:
npm ERR! gyp info find VS "C:Program Files (x86)Microsoft Visual Studio2017Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:UsersAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\Users\Study\clone\spring-reactjs\frontend\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Study\clone\spring-reactjs\frontend\node_modules\nodejs-java\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Study\clone\spring-reactjs\frontend\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\AppData\Local\node-gyp\Cache\18.15.0\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\AppData\Local\node-gyp\Cache\18.15.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Users\Study\clone\spring-reactjs\frontend\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\AppData\\Local\\node-gyp\\Cache\\18.15.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\Users\Study\clone\spring-reactjs\frontend\node_modules\nodejs-java',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\Users\Study\clone\spring-reactjs\frontend\node_modules\nodejs-java\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0BinMSBuild.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=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `C:Program Files (x86)Microsoft Visual Studio2017CommunityMSBuild15.0BinMSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onExit (C:UsersStudyclonespring-reactjsfrontendnode_modulesnode-gyplibbuild.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Study\clone\spring-reactjs\frontend\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:UsersStudyclonespring-reactjsfrontendnode_modulesnodejs-java
npm ERR! gyp ERR! node -v v18.15.0
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:UsersAppDataLocalnpm-cache_logs2023-03-15T06_55_56_961Z-debug-0.log
2
Answers
Just try this command in case of dependency problems
or did you need to create a react app the following command
to run the created app
Looks like it needs
node-gyp
andpython
. Runnpm i -g node-gyp
command to install node-gyp globally. And install Python from official site.Edit: Also, don’t forget to add Python to path. There will be option while installing python, for adding the path to environment variables.