343dev / optimizt

CLI image optimization tool
MIT License
85 stars 3 forks source link

Issue while installing the module on windows #13

Closed kookline closed 3 weeks ago

kookline commented 3 weeks ago

Hello !

I ran npm i -g @343dev/optimizt on a brand new windows 10 sandbox with node v20.18.0 just installed and I get an issue. I tried as well with every other version of the module published, and none worked. However, the funboxteam version installed properly without issues, if that can help you find what changed.

Here's the stdout I get :

PS C:\Users\WDAGUtilityAccount> npm i -g @343dev/optimizt
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
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 cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     'C:\\Users\\WDAGUtilityAccount\\AppData\\Roaming\\nvm\\v20.18.0\\node_modules\\@343dev\\optimizt\\node_modules',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\@sindresorhus\is\dist\source'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\WDAGUtilityAccount\\AppData\\Roaming\\nvm\\v20.18.0\\node_modules\\@343dev\\optimizt\\node_modules\\@sindresorhus\\is\\dist\\source'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     'C:\\Users\\WDAGUtilityAccount\\AppData\\Roaming\\nvm\\v20.18.0\\node_modules\\@343dev\\optimizt',
npm warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\csso\node_modules\css-tree'] {
npm warn cleanup       errno: -4048,
npm warn cleanup       code: 'EPERM',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: 'C:\\Users\\WDAGUtilityAccount\\AppData\\Roaming\\nvm\\v20.18.0\\node_modules\\@343dev\\optimizt\\node_modules\\csso\\node_modules\\css-tree'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\guetzli
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c node lib/install.js
npm error compiling from source
npm error guetzli built successfully
npm error Command failed: C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\guetzli\vendor\guetzli.exe C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\guetzli\test\fixtures\test.jpg C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\guetzli\test\fixtures\dest.jpg
npm error Can't open input file
npm error
npm error
npm error guetzli pre-build test failed
npm error C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\execa\index.js:231
npm error                               err = new Error(`Command failed: ${joinedCmd}${output}`);
npm error                                     ^
npm error
npm error Error: Command failed: C:\Windows\system32\cmd.exe /s /c "make && mv bin/Release/guetzli.exe C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\guetzli\vendor\guetzli.exe"
npm error 'make' is not recognized as an internal or external command,
npm error operable program or batch file.
npm error
npm error
npm error     at C:\Users\WDAGUtilityAccount\AppData\Roaming\nvm\v20.18.0\node_modules\@343dev\optimizt\node_modules\execa\index.js:231:11
npm error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
npm error   code: 1,
npm error   killed: false,
npm error   stdout: '',
npm error   stderr: "'make' is not recognized as an internal or external command,\r\n" +
npm error     'operable program or batch file.\r\n',
npm error   failed: true,
npm error   signal: null,
npm error   cmd: 'C:\\Windows\\system32\\cmd.exe /s /c "make && mv bin/Release/guetzli.exe C:\\Users\\WDAGUtilityAccount\\AppData\\Roaming\\nvm\\v20.18.0\\node_modules\\@343dev\\optimizt\\node_modules\\guetzli\\vendor\\guetzli.exe"',
npm error   timedOut: false
npm error }
npm error
npm error Node.js v20.18.0
npm notice
npm notice New minor version of npm available! 10.8.2 -> 10.9.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.0
npm notice To update run: npm install -g npm@10.9.0
npm notice
npm error A complete log of this run can be found in: C:\Users\WDAGUtilityAccount\AppData\Local\npm-cache\_logs\2024-10-07T12_32_02_210Z-debug-0.log
PS C:\Users\WDAGUtilityAccount>

I also added the complete npm log as a file

Let me know if you need any more information on the issue.

Thanks in advance !

343dev commented 3 weeks ago

Hi, @kookline! Thanks for reporting the bug.

This is an old issue related to installing the guetzli module, which Optimizt uses for lossless JPEG image optimization. Two years ago, I asked the module’s author to fix the problem and even made a PR, but I didn’t get a reply.

In the old version from the funboxteam scope, we used a modified version of guetzli. After moving to the 343dev scope, I switched back to the original version. It seems the installation problem only happens on Windows systems that don’t use WSL, so I didn’t encounter it during the transition.

I’ve forked the guetzli repository, fixed the issue, and now Optimizt will use my patched version.

Version 9.0.2 with this fix is already available on npm. Please try installing it and let me know how it goes.

kookline commented 3 weeks ago

Thanks for the very swift reply, and new version !

I can confirm it works now.

zaosoula commented 2 weeks ago

Hello @343dev seems like the problem came back, I'm using version 9.1.0 on OSX

# This file contains the result of Yarn building a package (guetzli@https://github.com/343dev/guetzli-bin.git#commit=427cef566261dfcde63c7f8aaebf1a47d8738150)
# Script name: postinstall

Command failed: /Users/zaosoula/Github/mobilitycare-root/node_modules/guetzli/vendor/guetzli /Users/zaosoula/Github/mobilitycare-root/node_modules/guetzli/test/fixtures/test.jpg /Users/zaosoula/Github/mobilitycare-root/node_modules/guetzli/test/fixtures/dest.jpg
Can't open input file

guetzli pre-build test failed
compiling from source
guetzli built successfully
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, open '/Users/zaosoula/Github/mobilitycare-root/node_modules/guetzli/vendor/source/guetzli-1.0.1.tar.gz'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/zaosoula/Github/mobilitycare-root/node_modules/guetzli/vendor/source/guetzli-1.0.1.tar.gz'
}

Node.js v18.20.2
343dev commented 2 weeks ago

Hello @343dev seems like the problem came back, I'm using version 9.1.0 on OSX

Hello. Please open a new issue.