lovell / sharp-libvips

Packaging scripts to prebuild libvips and its dependencies - you're probably looking for https://github.com/lovell/sharp
Apache License 2.0
168 stars 93 forks source link

Sharp integration failed #181

Closed nnphongphu closed 1 year ago

nnphongphu commented 1 year ago

I just ran ./build.sh 8.14.2 win32-ia32 and got libvips-8.14.2-win32-ia32.tar.br; however when I use this as a sharp_libvips_local_prebuilds it fails with an error as follows:

Am I building it wrong? Because when I use the released libvips-8.14.2-win32-ia32.tar.br as sharp_libvips_local_prebuilds, it still works ok


npm ERR! code 1
npm ERR! path D:\sharp-custom\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Using local libvips from D:\sharp-custom\libvips\v8.14.2\libvips-8.14.2-win32-ia32.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR!
npm ERR!   nothing.c
npm ERR!   win_delay_load_hook.cc
npm ERR!   nothing.vcxproj -> D:\sharp-custom\node_modules\sharp\build\Release\\nothing.lib
npm ERR!   VConnection.cpp
npm ERR! D:\sharp-custom\node_modules\sharp\src\libvips\cplusplus\VConnection.cpp(35,10): fatal  error C1083: Cannot open include file: 'vips/vips8': No such file or directory [D:\sharp-custom\node_modules\sharp\build\libvips-cpp.vcxproj]
npm ERR! sharp: Installation error: ENOTEMPTY: directory not empty, rmdir '\\?\D:\sharp-custom\node_modules\sharp\vendor\8.14.2\win32-ia32\lib'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.12.1 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.9 found at "C:\Users\LAP12418-local\anaconda3\python.exe"
npm ERR! gyp info find VS using VS2022 (17.5.33530.505) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\LAP12418-local\anaconda3\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\LAP12418-local\\AppData\\Roaming\\nvm\\v18.12.1\\node_modules\\npm\\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   'D:\\sharp-custom\\node_modules\\sharp\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\LAP12418-local\\AppData\\Roaming\\nvm\\v18.12.1\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\LAP12418-local\\AppData\\Local\\node-gyp\\Cache\\18.12.1\\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\\LAP12418-local\\AppData\\Local\\node-gyp\\Cache\\18.12.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\LAP12418-local\\AppData\\Roaming\\nvm\\v18.12.1\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\LAP12418-local\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\18.12.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=D:\\sharp-custom\\node_modules\\sharp',
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   'D:\\sharp-custom\\node_modules\\sharp\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\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\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\LAP12418-local\AppData\Roaming\nvm\v18.12.1\node_modules\npm\node_modules\node-gyp\lib\build.js:201: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.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\LAP12418-local\\AppData\\Roaming\\nvm\\v18.12.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd D:\sharp-custom\node_modules\sharp
npm ERR! gyp ERR! node -v v18.12.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\LAP12418-local\AppData\Local\npm-cache\_logs\2023-04-19T03_37_36_808Z-debug-0.log```
nnphongphu commented 1 year ago

I fixed it by setting npm_package_config_integrity_platform_arch to the right hash value. Lol, the error message is really confusing.

lovell commented 1 year ago

Commit https://github.com/lovell/sharp/commit/d08baa20e6c1f617e1aea413805b7657abeaaf51 should ensure both the installation error and the integrity check failure are logged to help reduce confusion for this edge case.