Closed sourcedelica closed 7 months ago
Please provide the command typed and the full error log.
Do you mean the part under Verbose output (from npm or node-gyp) that starts with node-pre-gyp install --fallback-to-build -j max --loglevel silly
?
I also added the npm debug log but there's not much there.
One other data point. I'm in the process of configuring a set of CI build machines, adding four more to an existing set of four. The CI job that I'm testing on the new machines is the one that's failing with this error. The job runs ok on the original build machines. The interesting thing is that on the original machines there is no .npmrc
with msvs_version
or msbuild_path
. It looks like Find-VisualStudio.cs can find VS even without these config vars set.
Is the version of npm
identical on all machines?
Yes - npm 10.2.3
The URL above points to some commands that should prove that those config vars are no longer valid on modern npm
.
Ahh - That explains why when I tried using npm config
to add them it wouldn't let me. I had to edit .npmrc
to put them in. :)
If you set them in .npmrc
and then do npm config list
, do they appear in the active settings?
Yes:
$ npm config list
; "user" config from C:\Users\svc_platform\.npmrc
msbuild_path = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\MSBuild.exe"
msvs_version = "2019"
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.19.0
; npm local prefix = C:\Users\svc_platform\ericp\llm-core
; npm version = 10.2.3
; cwd = C:\Users\svc_platform\ericp\llm-core
; HOME = C:\Users\svc_platform
; Run `npm config ls -l` to show all defaults.
I found a fix. Adding -IgnoreWarnings
to the Add-Type
call in find-visualstudio.js
fixes the problem, though editing the node-gyp source code is not my preferred solution :).
I'm not sure where the LIB
environment variable is coming from. It's not set at the system or user level for the user I'm using.
This fix also works if I remove the msvs_version and msbuild_path settings from ~/.npmrc.
Do you have any comments or suggestions for our docs or #2959?
Both Windows and Node are outside of my usual domain so my understanding is somewhat limited, otherwise I might have some better feedback. Looking at the docs I don't see msbuild_path
- I must have gotten that from googling around after I ran into the Add-Path error. I'm not sure if that should be documented or not.
Another datapoint I have is on this part of the README:
It's advised to install following Powershell module: [VSSetup](https://github.com/microsoft/vssetup.powershell) using
Install-Module VSSetup -Scope CurrentUser. This will make Visual Studio detection logic to use more flexible and
accessible method, avoiding Powershell's ConstrainedLanguage mode.
It worked for me without installing VSSetup.
On a different topic:
Should I submit a PR to add -IgnoreWarnings
to the Add-Type
call in find-visualstudio.js
? It's not the best fix in the world. It would be better to not ignore warnings and solve what seems to be the core problem: Invalid search path 'lib\\um\\x64' specified in 'LIB environment variable'
. But on the other hand I don't want to be patching node-gyp indefinitely, stuck on version 10.0.1 :)
Also facing this one.
@sourcedelica solution solves the issue but I totally agree with them on the relevance of this type of fix. I've also investigated on my side about the source of this 'lib\\um\\x64'
path without success for the moment.
@sourcedelica Can this be closed?
Could you clarify what you were asking - either, can this issue (#2981) be closed, or the one you linked (https://github.com/mapbox/node-pre-gyp/issues/657) be closed?
I can't comment on the second issue but the original problem (this issue, #2981) is still a problem - we're still patching find-visualstudio.js
after installation. Unless there's a workaround that I missed it should stay open to indicate that it's still a problem.
I was asking if this issue be closed.
Can you replicate this problem without using node-pre-gyp
which is no longer maintained?
https://github.com/mapbox/node-pre-gyp/pull/712 demonstrates that support in lib/util/abi_crosswalk.json
currently stops at Node.js v17.
To make node-pre-gyp
support Node.js > v17 you can try:
npm ci # node-pre-gyp
npm run update-crosswalk
.npmrc:
Verbose output (from npm or node-gyp):
``` > node-pre-gyp install --fallback-to-build -j max --loglevel silly node-pre-gyp info it worked if it ends with ok node-pre-gyp verb cli [ node-pre-gyp verb cli 'C:\\Program Files\\nodejs\\node.exe', node-pre-gyp verb cli 'C:\\Users\\svc_platform\\ericp\\llm-core\\build\\llm\\bindings\\node\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp', node-pre-gyp verb cli 'install', node-pre-gyp verb cli '--fallback-to-build', node-pre-gyp verb cli '-j', node-pre-gyp verb cli 'max', node-pre-gyp verb cli '--loglevel', node-pre-gyp verb cli 'silly' node-pre-gyp verb cli ] node-pre-gyp info using node-pre-gyp@1.0.10 node-pre-gyp info using node@18.19.0 | win32 | x64 node-pre-gyp verb command install [ 'max' ] node-pre-gyp info build requesting source compile node-pre-gyp verb command build [ 'rebuild', 'max' ] gyp info it worked if it ends with ok gyp info using node-gyp@10.0.1 gyp info using node@18.19.0 | win32 | x64 gyp info ok gyp info it worked if it ends with ok gyp verb cli [ gyp verb cli 'C:\\Program Files\\nodejs\\node.exe', gyp verb cli 'C:\\ProgramData\\nvm\\v18.19.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js', gyp verb cli 'configure', gyp verb cli '--fallback-to-build', gyp verb cli '--jobs=max', gyp verb cli '--loglevel=silly', gyp verb cli '--module=C:\\Users\\svc_platform\\ericp\\llm-core\\build\\llm\\bindings\\node\\build\\binding\\Release\\node-v108-win32-x64\\llm.node', gyp verb cli '--module_name=llm', gyp verb cli '--module_path=C:\\Users\\svc_platform\\ericp\\llm-core\\build\\llm\\bindings\\node\\build\\binding\\Release\\node-v108-win32-x64', gyp verb cli '--napi_version=9', gyp verb cli '--node_abi_napi=napi', gyp verb cli '--napi_build_version=0', gyp verb cli '--node_napi_label=node-v108', gyp verb cli '--msvs_version=2019' gyp verb cli ] gyp info using node-gyp@10.0.1 gyp info using node@18.19.0 | win32 | x64 gyp verb find Python Python is not set from command line or npm configuration gyp verb find Python Python is not set from environment variable PYTHON gyp verb find Python checking if the py launcher can be used to find Python 3 gyp verb find Python - executing "py.exe" to get Python 3 executable path gyp sill find Python execFile: exec = "py.exe" gyp sill find Python execFile: args = ["-3","-c","import sys; print(sys.executable);"] gyp sill find Python execFile result: err = null gyp sill find Python execFile result: stdout = "3.9.13\r\n" gyp sill find Python execFile result: stderr = "" gyp verb find Python - version is "3.9.13" gyp info find Python using Python version 3.9.13 found at "C:\Users\svc_platform\AppData\Local\Programs\Python\Python39\python.exe" gyp verb get node dir no --target version specified, falling back to host node version: 18.19.0 gyp verb install input version string "18.19.0" gyp verb install installing version: 18.19.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version is already installed, need to check "installVersion" gyp verb got "installVersion" 11 gyp verb needs "installVersion" 11 gyp verb install version is good gyp verb on Windows; need to check node.lib gyp verb get node dir target node version installed: 18.19.0 gyp verb build dir attempting to create "build" dir: C:\Users\svc_platform\ericp\llm-core\build\llm\bindings\node\build gyp verb build dir "build" dir needed to be created? Yes gyp verb find VS msvs_version was set from command line or npm config gyp verb find VS - looking for Visual Studio version 2019 gyp verb find VS running in VS Command Prompt, installation path is: gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" gyp verb find VS - will only use this version gyp sill find VS Running C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [ gyp sill find VS '-ExecutionPolicy', gyp sill find VS 'Unrestricted', gyp sill find VS '-NoProfile', gyp sill find VS '-Command', gyp sill find VS "&{Add-Type -Path 'C:\\ProgramData\\nvm\\v18.19.0\\node_modules\\npm\\node_modules\\node-gyp\\lib\\Find-VisualStudio.cs';[VisualStudioConfiguration.Main]::PrintJson()}" gyp sill find VS ] gyp sill find VS PS stderr = "Add-Type : (0) : Warning as Error: Invalid search path 'lib\\um\\x64' specified in 'LIB environment variable' -- 'The \r\nsystem can not find the path specified. '\r\nAt line:1 char:3\r\n+ &{Add-Type -Path 'C:\\ProgramData\\nvm\\v18.19.0\\node_modules\\npm\\node_m ...\r\n+ ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type] , Except \r\n ion\r\n + FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand\r\n \r\nAdd-Type : Cannot add type. Compilatio n errors occurred.\r\nAt line:1 char:3\r\n+ &{Add-Type -Path 'C:\\ProgramData\\nvm\\v18.19.0\\node_modules\\npm\\node_m ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException\r\n + FullyQualifiedErrorId : COMP ILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand\r\n \r\nUnable to find type [VisualStudioConfiguration.Main].\r\nAt line:1 char:112\r\n+ ... yp\\lib\\Fin d-VisualStudio.cs';[VisualStudioConfiguration.Main]::PrintJ ...\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n + CategoryInfo : InvalidOperation: (VisualStudioConfiguration.Main:TypeName) [], RuntimeException\r\n + FullyQualifiedErrorId : TypeNotFound\r\n \r\n" gyp sill find VS PS stdout = "" gyp sill find VS SyntaxError: Unexpected end of JSON input gyp sill find VS at JSON.parse (npm debug log:
``` 0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js 1 info using npm@10.2.3 2 info using node@v18.19.0 3 timing npm:load:whichnode Completed in 3ms 4 timing config:load:defaults Completed in 3ms 5 timing config:load:file:C:\ProgramData\nvm\v18.19.0\node_modules\npm\npmrc Completed in 2ms 6 timing config:load:builtin Completed in 3ms 7 timing config:load:cli Completed in 2ms 8 timing config:load:env Completed in 1ms 9 timing config:load:file:C:\Users\svc_platform\ericp\llm-core\build\llm\bindings\node\.npmrc Completed in 1ms 10 timing config:load:project Completed in 2ms 11 timing config:load:file:C:\Users\svc_platform\.npmrc Completed in 2ms 12 timing config:load:user Completed in 2ms 13 timing config:load:file:C:\Program Files\nodejs\etc\npmrc Completed in 0ms 14 timing config:load:global Completed in 0ms 15 timing config:load:setEnvs Completed in 1ms 16 timing config:load Completed in 15ms 17 timing npm:load:configload Completed in 15ms 18 timing config:load:flatten Completed in 3ms 19 timing npm:load:mkdirpcache Completed in 0ms 20 timing npm:load:mkdirplogs Completed in 0ms 21 verbose title npm install 22 verbose argv "install" "--build-from-source" 23 timing npm:load:setTitle Completed in 2ms 24 timing npm:load:display Completed in 1ms 25 verbose logfile logs-max:10 dir:C:\Users\svc_platform\AppData\Local\npm-cache\_logs\2024-02-11T02_23_13_016Z- 26 verbose logfile C:\Users\svc_platform\AppData\Local\npm-cache\_logs\2024-02-11T02_23_13_016Z-debug-0.log 27 timing npm:load:logFile Completed in 12ms 28 timing npm:load:timers Completed in 0ms 29 timing npm:load:configScope Completed in 0ms 30 timing npm:load Completed in 60ms 31 timing arborist:ctor Completed in 0ms 32 silly logfile start cleaning logs, removing 2 files 33 timing idealTree:init Completed in 47ms 34 timing idealTree:userRequests Completed in 0ms 35 silly idealTree buildDeps 36 timing idealTree:#root Completed in 0ms 37 timing idealTree:buildDeps Completed in 2ms 38 timing idealTree:fixDepFlags Completed in 0ms 39 timing idealTree Completed in 51ms 40 silly logfile done cleaning log files 41 timing arborist:ctor Completed in 0ms 42 timing reify:loadTrees Completed in 68ms 43 timing reify:diffTrees Completed in 5ms 44 silly reify moves {} 45 timing reify:retireShallow Completed in 1ms 46 timing reify:createSparse Completed in 0ms 47 timing reify:loadBundles Completed in 0ms 48 silly audit bulk request { 48 silly audit '@mapbox/node-pre-gyp': [ '1.0.10' ], 48 silly audit abbrev: [ '1.1.1' ], 48 silly audit 'agent-base': [ '6.0.2' ], 48 silly audit 'ansi-regex': [ '5.0.1' ], 48 silly audit aproba: [ '2.0.0' ], 48 silly audit 'are-we-there-yet': [ '2.0.0' ], 48 silly audit 'balanced-match': [ '1.0.2' ], 48 silly audit 'brace-expansion': [ '1.1.11' ], 48 silly audit chownr: [ '2.0.0' ], 48 silly audit 'color-support': [ '1.1.3' ], 48 silly audit 'concat-map': [ '0.0.1' ], 48 silly audit 'console-control-strings': [ '1.1.0' ], 48 silly audit debug: [ '4.3.4' ], 48 silly audit delegates: [ '1.0.0' ], 48 silly audit 'detect-libc': [ '2.0.2' ], 48 silly audit 'emoji-regex': [ '8.0.0' ], 48 silly audit 'fs-minipass': [ '2.1.0' ], 48 silly audit minipass: [ '3.3.6', '5.0.0' ], 48 silly audit 'fs.realpath': [ '1.0.0' ], 48 silly audit gauge: [ '3.0.2' ], 48 silly audit glob: [ '7.2.3' ], 48 silly audit 'has-unicode': [ '2.0.1' ], 48 silly audit 'https-proxy-agent': [ '5.0.1' ], 48 silly audit inflight: [ '1.0.6' ], 48 silly audit inherits: [ '2.0.4' ], 48 silly audit 'is-fullwidth-code-point': [ '3.0.0' ], 48 silly audit 'lru-cache': [ '6.0.0' ], 48 silly audit 'make-dir': [ '3.1.0' ], 48 silly audit semver: [ '6.3.1', '7.6.0' ], 48 silly audit minimatch: [ '3.1.2' ], 48 silly audit minizlib: [ '2.1.2' ], 48 silly audit mkdirp: [ '1.0.4' ], 48 silly audit ms: [ '2.1.2' ], 48 silly audit 'node-addon-api': [ '6.1.0' ], 48 silly audit 'node-fetch': [ '2.7.0' ], 48 silly audit nopt: [ '5.0.0' ], 48 silly audit npmlog: [ '5.0.1' ], 48 silly audit 'object-assign': [ '4.1.1' ], 48 silly audit once: [ '1.4.0' ], 48 silly audit 'path-is-absolute': [ '1.0.1' ], 48 silly audit 'readable-stream': [ '3.6.2' ], 48 silly audit rimraf: [ '3.0.2' ], 48 silly audit 'safe-buffer': [ '5.2.1' ], 48 silly audit 'set-blocking': [ '2.0.0' ], 48 silly audit 'signal-exit': [ '3.0.7' ], 48 silly audit string_decoder: [ '1.3.0' ], 48 silly audit 'string-width': [ '4.2.3' ], 48 silly audit 'strip-ansi': [ '6.0.1' ], 48 silly audit tar: [ '6.2.0' ], 48 silly audit tr46: [ '0.0.3' ], 48 silly audit 'util-deprecate': [ '1.0.2' ], 48 silly audit 'webidl-conversions': [ '3.0.1' ], 48 silly audit 'whatwg-url': [ '5.0.0' ], 48 silly audit 'wide-align': [ '1.1.5' ], 48 silly audit wrappy: [ '1.0.2' ], 48 silly audit yallist: [ '4.0.0' ] 48 silly audit } 49 timing reify:unpack Completed in 3ms 50 timing reify:unretire Completed in 34ms 51 timing build:queue Completed in 0ms 52 timing build:deps Completed in 0ms 53 timing build Completed in 0ms 54 timing reify:build Completed in 1ms 55 timing reify:trash Completed in 0ms 56 timing reify:save Completed in 28ms 57 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 215ms 58 timing auditReport:getReport Completed in 220ms 59 silly audit report {} 60 timing auditReport:init Completed in 0ms 61 timing reify:audit Completed in 220ms 62 timing reify Completed in 303ms 63 timing command:install Completed in 1862ms 64 verbose stack Error: command failed 64 verbose stack at ChildProcess.The problem seems to be
I tried running the same command from the Powershell command line and it worked fine: