minify icon indicating copy to clipboard operation
minify copied to clipboard

node-gyp-build Environmental dependency issues

Open itmanyong opened this issue 2 years ago • 3 comments

          @privatenumber Any update on this? Regarding this fixed, please reopen if not.

Originally posted by @tdewolff in https://github.com/tdewolff/minify/issues/519#issuecomment-1336583890

  • This problem seems to have not been resolved, as follows
PS D:\Users\itmanyong\Desktop\gulp-wx> pnpm add @tdewolff/minify -D
 WARN  deprecated [email protected]: This SVGO version is no longer supported. Upgrade to v2.x.x.
 WARN  deprecated [email protected]: The functionality that this package provided is now in @npmcli/arborist
 WARN  deprecated [email protected]: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
 WARN  deprecated [email protected]: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2
 WARN  deprecated [email protected]: This functionality has been moved to @npmcli/fs
 WARN  deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
 WARN  deprecated [email protected]: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
 WARN  deprecated [email protected]: 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.
 WARN  deprecated [email protected]: flatten is deprecated in favor of utility frameworks such as lodash.
 WARN  deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
 WARN  deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
 WARN  deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
 WARN  deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
 WARN  deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
Packages: +842
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 847, reused 845, downloaded 0, added 0, done
node_modules/.pnpm/@[email protected]/node_modules/@tdewolff/minify: Running install script, failed in 1.7s
.../node_modules/@tdewolff/minify install$ node-gyp-build
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | win32 | x64
│ gyp info find Python using Python version 3.10.8 found at "C:\Users\itmanyong\AppData\Local\Programs\Python\Python310\python.exe"
│ gyp ERR! find VS
│ gyp ERR! find VS msvs_version not set from command line or npm config
│ gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
│ gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
│ gyp ERR! find VS looking for Visual Studio 2015
│ gyp ERR! find VS - not found
│ gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
│ gyp ERR! find VS
│ gyp ERR! find VS **************************************************************
│ gyp ERR! find VS You need to install the latest version of Visual Studio
│ gyp ERR! find VS including the "Desktop development with C++" workload.
│ gyp ERR! find VS For more information consult the documentation at:
│ gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
│ gyp ERR! find VS **************************************************************
│ gyp ERR! find VS
│ gyp ERR! configure error
│ gyp ERR! stack Error: Could not find any Visual Studio installation to use
│ gyp ERR! stack     at VisualStudioFinder.fail (D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\find-visualstudi
│ gyp ERR! stack     at D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\find-visualstudio.js:75:16
│ gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\
│ gyp ERR! stack     at D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\find-visualstudio.js:71:14
│ gyp ERR! stack     at D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\find-visualstudio.js:390:16
│ gyp ERR! stack     at D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\util.js:54:7
│ gyp ERR! stack     at D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\[email protected]\node_modules\node-gyp\lib\util.js:33:16
│ gyp ERR! stack     at ChildProcess.exithandler (node:child_process:420:5)
│ gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
│ gyp ERR! stack     at maybeClose (node:internal/child_process:1091:16)
│ gyp ERR! System Windows_NT 10.0.18363
│ gyp ERR! command "D:\\nodejs\\node.exe" "D:\\Users\\itmanyong\\Desktop\\gulp-wx\\node_modules\\.pnpm\\[email protected]\\node_modules\\node-gyp\\bin\\node-gyp.js
│ gyp ERR! cwd D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\@[email protected]\node_modules\@tdewolff\minify
│ gyp ERR! node -v v18.12.1
│ gyp ERR! node-gyp -v v9.3.1
│ gyp ERR! not ok
└─ Failed in 1.7s at D:\Users\itmanyong\Desktop\gulp-wx\node_modules\.pnpm\@[email protected]\node_modules\@tdewolff\minify
 ELIFECYCLE  Command failed with exit code 1.
PS D:\Users\itmanyong\Desktop\gulp-wx>
  • My system information
PS D:\Users\itmanyong\Desktop\gulp-wx> npx envinfo --system --binaries

  System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Memory: 5.83 GB / 15.95 GB
  Binaries:
    Node: 18.12.1 - D:\nodejs\node.EXE
    Yarn: 1.22.18 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.9.0 - D:\nodejs\npm.CMD

PS D:\Users\itmanyong\Desktop\gulp-wx>
  • Attempted to clean local cache and install separately npm install node-gyp-build@latest -g,Still not working

itmanyong avatar May 18 '23 07:05 itmanyong

When I wrote the script, it was near impossible to make it work on Windows. It works on MacOS and Linux however. I will see if this has changed, but unfortunately I have no Windows available to test.

tdewolff avatar May 18 '23 19:05 tdewolff

When I wrote the script, it was near impossible to make it work on Windows. It works on MacOS and Linux however. I will see if this has changed, but unfortunately I have no Windows available to test.

This is very uncomfortable. Windows environments can be built using virtual machines, but I don't know if such a virtual environment meets the requirements. This library is great! I hope to consider compatibility with Windows in my spare time. This will add a lot of points. Thank you for creating it

itmanyong avatar May 19 '23 05:05 itmanyong

The problem is much worse. After working on this for two days, it seems that Go/CGO only compiles with GCC, and node-gyp only compiles with MSVC, and the resulting node library is not working. The problem that occurs is: "Error: Module did not self-register". In your specific case though, you didn't install VS, see https://github.com/tdewolff/minify/tree/master/bindings/js#installation-on-windows

tdewolff avatar May 23 '23 01:05 tdewolff