Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when install using npm 8.x, node-gyp rebuild runs instead of node-pre-gyp, so prebuilt binaries are not downloaded #2082

Open
1 task done
benwalder opened this issue Jul 26, 2022 · 10 comments

Comments

@benwalder
Copy link

Issue or Feature

When using npm 6, the install runs node-pre-gyp to download prebuilt binaries as expected and the install is successful.

When using npm 8, the install runs node-gyp which attempts to rebuild the binaries and the install fails because pkg-config is not available.

We want to download the prebuilt binaries, not rebuild them. What is needed to have node-pre-gyp run with npm 8?

Steps to Reproduce

App package.json contains only canvas as a dependency to make it as simple as possible:

"dependencies": {
    "canvas": "^2.9.3"
  }

Ensure starting from scratch:
rm -rf node_modules
rm package-lock.json

npm 6 install successful: npm install runs node-pre-gyp install --fallback-to-build --update-binary

npm install --verbose
< lines removed >
npm info lifecycle canvas@2.9.3~install: canvas@2.9.3

> canvas@2.9.3 install /Users/developer/Documents/dev/test/node_modules/canvas
> node-pre-gyp install --fallback-to-build --update-binary

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [
node-pre-gyp verb cli   '/usr/local/bin/node',
node-pre-gyp verb cli   '/Users/developer/Documents/dev/test/node_modules/.bin/node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build',
node-pre-gyp verb cli   '--update-binary'
node-pre-gyp verb cli ]
node-pre-gyp info using node-pre-gyp@1.0.9
node-pre-gyp info using node@16.16.0 | darwin | x64
node-pre-gyp verb command install []
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v93-darwin-unknown-x64.tar.gz
node-pre-gyp http download proxy agent configured using: "http://<removed>:8000"
node-pre-gyp info install unpacking Release/
< lines removed >

npm 8 install failure: npm install runs node-gyp rebulld instead of node-pre-gyp install --fallback-to-build --update-binary:

npm install --verbose
< lines removed>
npm timing build:link:node_modules/@mapbox/node-pre-gyp Completed in 5ms
npm timing build:link:node_modules/mkdirp Completed in 4ms
npm timing build:link:node_modules/rimraf Completed in 4ms
npm timing build:link:node_modules/semver Completed in 4ms
npm timing build:link:node_modules/nopt Completed in 5ms
npm timing build:link:node_modules/color-support Completed in 6ms
npm timing build:link:node_modules/make-dir/node_modules/semver Completed in 5ms
npm timing build:link Completed in 6ms
npm info run canvas@2.9.3 install node_modules/canvas node-gyp rebuild
< lines removed >
npm timing command:i Completed in 25221ms
npm verb stack Error: command failed
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:63:27)
npm verb stack     at ChildProcess.emit (node:events:527:28)
npm verb stack     at maybeClose (node:internal/child_process:1092:16)
npm verb stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid canvas@2.9.3
npm verb cwd /Users/developer/Documents/dev/test
npm verb Darwin 21.5.0
npm verb node v16.16.0
npm verb npm  v8.15.0
npm ERR! code 1
npm ERR! path /Users/developer/Documents/dev/test/node_modules/canvas
npm ERR! command failed
npm ERR! command sh /var/folders/lz/021n8xl50lg7h3qlm0knb1qrgw086n/T/install-f6f99e1b.sh
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/usr/local/bin/node',
npm ERR! gyp verb cli   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | darwin | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
< lines removed>
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 

Your Environment

macOS 12.4
System Darwin 21.5.0
node -v v16.16.0
npm -v 8.15.0
"canvas": "^2.9.3"

@shuashuai
Copy link

I had the same problem

@benwalder
Copy link
Author

benwalder commented Jul 28, 2022

npm/cli#5234. It seems if there is a binding.gyp file in the root dir, npm always runs the default install command node-gyp rebuild.

Renaming or removing binding.gyp after the prebuild may be a workaround so the binaries are downloaded as they used to be with npm 6.

@woestler

This comment was marked as off-topic.

@Autokaka

This comment was marked as duplicate.

@mustafaekim
Copy link

mustafaekim commented Aug 17, 2022

My npm version is 8.12.1 and "npm i canvas" runs "node-pre-gyp install --fallback-to-build --update-binary" however the install fails as below. How can I install canvas?

PS. I already had canvas on my node_modules, I installed with multiple times. Today I cleared the node_modules folder and installed all packages again, only I had issue with canvas. I don't know what could have been changed?

npm info run canvas@2.9.3 install node_modules/canvas node-pre-gyp install --fallback-to-build --update-binary
npm info run canvas@2.9.3 install { code: 1, signal: null }
npm timing reify:rollback:createSparse Completed in 104ms
npm timing reify:rollback:retireShallow Completed in 0ms
npm timing command:i Completed in 27171ms
npm verb stack Error: command failed
npm verb stack     at ChildProcess.<anonymous> (C:\Users\ekimm\AppData\Roaming\nvm\v16.15.1\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:63:27)
npm verb stack     at ChildProcess.emit (node:events:527:28)
npm verb stack     at maybeClose (node:internal/child_process:1092:16)
npm verb stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid canvas@2.9.3
npm verb cwd C:\Files\Dev\test1
npm verb Windows_NT 10.0.22000
npm verb node v16.15.1
npm verb npm  v8.12.1
npm ERR! code 1
npm ERR! path C:\Files\Dev\test1\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Warning: Missing input files:
npm ERR! C:\GTK\bin\libpangowin32-1.0-0.dll
npm ERR! C:\GTK\bin\libcairo-2.dll
npm ERR! C:\GTK\bin\libgthread-2.0-0.dll
npm ERR! C:\GTK\bin\libexpat-1.dll
npm ERR! C:\GTK\bin\libpangoft2-1.0-0.dll
npm ERR! C:\GTK\bin\libintl-8.dll
npm ERR! C:\GTK\bin\libgobject-2.0-0.dll
npm ERR! C:\GTK\bin\libpango-1.0-0.dll
npm ERR! C:\GTK\bin\libfreetype-6.dll
npm ERR! C:\GTK\bin\libpng14-14.dll
npm ERR! C:\GTK\bin\zlib1.dll
npm ERR! C:\GTK\bin\libfontconfig-1.dll
npm ERR! C:\GTK\bin\libgmodule-2.0-0.dll
npm ERR! C:\GTK\bin\libpangocairo-1.0-0.dll
npm ERR! C:\GTK\bin\libglib-2.0-0.dll
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.       
npm ERR! Build started 17/08/2022 14:39:07.
npm ERR! Project "C:\Files\Dev\test1\node_modules\canvas\build\binding.sln" on node 1 (default targets).
npm ERR! ValidateSolutionConfiguration:
npm ERR!   Building solution configuration "Release|x64".
npm ERR! Project "C:\Files\Dev\test1\node_modules\canvas\build\binding.sln" (1) is building "C:\Files\Dev\test1\node_modules\canvas\build\canvas-postbuild.vcxproj.metaproj" (2) on node 1 (default targets).
npm ERR! Project "C:\Files\Dev\test1\node_modules\canvas\build\canvas-postbuild.vcxproj.metaproj" (2) is building "C:\Files\Dev\test1\node_modules\canvas\build\canvas.vcxproj" (3) on node 1 (default targets).
npm ERR! PrepareForBuild:
npm ERR!   Creating directory "Release\obj\canvas\".
npm ERR!   Creating directory "Release\obj\canvas\canvas.tlog\".
npm ERR! InitializeBuildStatus:
npm ERR!   Creating "Release\obj\canvas\canvas.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
npm ERR! MakeDirsForCl:
npm ERR!   Creating directory "C:\Files\Dev\test1\node_modules\canvas\build\Release\obj\canvas\src\backend".
npm ERR!   Creating directory "C:\Files\Dev\test1\node_modules\canvas\build\Release\obj\canvas\src\bmp".
npm ERR! ClCompile:
npm ERR!   C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\CL.exe /c /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\include\node" /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\src" /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\deps\openssl\config" /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\deps\openssl\openssl\include" /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\deps\uv\include" /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\deps\zlib" /I"C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1\deps\v8\include" /I..\..\nan /IC:\GTK\include /IC:\GTK\include\cairo /I"C:\GTK\include\pango-1.0" /I"C:\GTK\include\glib-2.0" /IC:\GTK\include\freetype2 /I"C:\GTK\lib\glib-2.0\include" /Z7 /nologo /W4 /WX- /diagnostics:classic /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=canvas /D USING_UV_SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNINGS=1 /D V8_DEPRECATION_WARNINGS /D V8_IMMINENT_DEPRECATION_WARNINGS /D _GLIBCXX_USE_CXX11_ABI=1 /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS=0 /D OPENSSL_NO_PINSHARED /D OPENSSL_THREADS /D _USE_MATH_DEFINES /D BUILDING_NODE_EXTENSION /D "HOST_BINARY=\"node.exe\"" /D _WINDLL /GF /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\canvas\\src\backend\Backend.obj" /Fd"Release\obj\canvas\vc141.pdb" /Gd /TP /wd4100 /wd4611 /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /errorReport:queue /Zc:__cplusplus ..\src\backend\Backend.cc
npm ERR!   Backend.cc
npm ERR! c:\files\dev\test1\node_modules\canvas\src\backend\backend.h(3): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory [C:\Files\Dev\test1\node_modules\canvas\build\canvas.vcxproj]
npm ERR! Done Building Project "C:\Files\Dev\test1\node_modules\canvas\build\canvas.vcxproj" (default targets) -- FAILED.  
npm ERR! Done Building Project "C:\Files\Dev\test1\node_modules\canvas\build\canvas-postbuild.vcxproj.metaproj" (default targets) -- FAILED.
npm ERR! Done Building Project "C:\Files\Dev\test1\node_modules\canvas\build\binding.sln" (default targets) -- FAILED.     
npm ERR!
npm ERR! Build FAILED.
npm ERR!
npm ERR! "C:\Files\Dev\test1\node_modules\canvas\build\binding.sln" (default target) (1) ->
npm ERR! "C:\Files\Dev\test1\node_modules\canvas\build\canvas-postbuild.vcxproj.metaproj" (default target) (2) ->
npm ERR! "C:\Files\Dev\test1\node_modules\canvas\build\canvas.vcxproj" (default target) (3) ->
npm ERR! (ClCompile target) ->
npm ERR!   c:\files\dev\test1\node_modules\canvas\src\backend\backend.h(3): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory [C:\Files\Dev\test1\node_modules\canvas\build\canvas.vcxproj]
npm ERR!
npm ERR!     0 Warning(s)
npm ERR!     1 Error(s)
npm ERR!
npm ERR! Time Elapsed 00:00:01.04
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\ekimm\AppData\Roaming\nvm\v16.15.1\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --update-binary --module=C:\Files\Dev\test1\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Files\Dev\test1\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp verb cli [
npm ERR! node-pre-gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! node-pre-gyp verb cli   'C:\\Files\\Dev\\test1\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp',
npm ERR! node-pre-gyp verb cli   'install',
npm ERR! node-pre-gyp verb cli   '--fallback-to-build',
npm ERR! node-pre-gyp verb cli   '--update-binary'
npm ERR! node-pre-gyp verb cli ]
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.9
npm ERR! node-pre-gyp info using node@16.15.1 | win32 | x64
npm ERR! node-pre-gyp verb command install []
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v93-win32-unknown-x64.tar.gz
npm ERR! node-pre-gyp ERR! install request to https://objects.githubusercontent.com/github-production-release-asset-2e65be/948957/64f6aed6-8f4c-4f94-be7a-af6d8932c2ec?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220817%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220817T113733Z&X-Amz-Expires=300&X-Amz-Signature=1d0daac05008b5dceab671b53f9f55de887c823862fc6cd2ac8ce38e6ee613da&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=948957&response-content-disposition=attachment%3B%20filename%3Dcanvas-v2.9.3-node-v93-win32-unknown-x64.tar.gz&response-content-type=application%2Foctet-stream failed, reason: connect ETIMEDOUT 185.199.111.133:443
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.9.3 and node@16.15.1 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error request to https://objects.githubusercontent.com/github-production-release-asset-2e65be/948957/64f6aed6-8f4c-4f94-be7a-af6d8932c2ec?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220817%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220817T113733Z&X-Amz-Expires=300&X-Amz-Signature=1d0daac05008b5dceab671b53f9f55de887c823862fc6cd2ac8ce38e6ee613da&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=948957&response-content-disposition=attachment%3B%20filename%3Dcanvas-v2.9.3-node-v93-win32-unknown-x64.tar.gz&response-content-type=application%2Foctet-stream failed, reason: connect ETIMEDOUT 185.199.111.133:443
npm ERR! node-pre-gyp verb command build [ 'rebuild' ]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\ekimm\\AppData\\Roaming\\nvm\\v16.15.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'clean'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.15.1 | win32 | x64
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\ekimm\\AppData\\Roaming\\nvm\\v16.15.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'configure',
npm ERR! gyp verb cli   '--fallback-to-build',
npm ERR! gyp verb cli   '--update-binary',
npm ERR! gyp verb cli   '--module=C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\Release\\canvas.node',
npm ERR! gyp verb cli   '--module_name=canvas',
npm ERR! gyp verb cli   '--module_path=C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\Release',
npm ERR! gyp verb cli   '--napi_version=8',
npm ERR! gyp verb cli   '--node_abi_napi=napi',
npm ERR! gyp verb cli   '--napi_build_version=0',
npm ERR! gyp verb cli   '--node_napi_label=node-v93'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.15.1 | win32 | x64
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
npm ERR! gyp verb find Python checking if "python" can be used
npm ERR! gyp verb find Python - executing "python" to get executable path
npm ERR! gyp verb find Python - executable path is "C:\Python39\python.exe"
npm ERR! gyp verb find Python - executing "C:\Python39\python.exe" to get version
npm ERR! gyp verb find Python - version is "3.9.4"
npm ERR! gyp info find Python using Python version 3.9.4 found at "C:\Python39\python.exe"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 16.15.1
npm ERR! gyp verb command install [ '16.15.1' ]
npm ERR! gyp verb install input version string "16.15.1"
npm ERR! gyp verb install installing version: 16.15.1
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 16.15.1
npm ERR! gyp verb build dir attempting to create "build" dir: C:\Files\Dev\test1\node_modules\canvas\build
npm ERR! gyp verb build dir "build" dir needed to be created? Yes
npm ERR! gyp verb find VS msvs_version not set from command line or npm config
npm ERR! gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp verb find VS checking VS2017 (15.9.28307.1500) found at:
npm ERR! gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp verb find VS - found "Visual Studio C++ core features"
npm ERR! gyp verb find VS - found VC++ toolset: v141
npm ERR! gyp verb find VS - found Windows SDK: 10.0.17763.0
npm ERR! gyp info find VS using VS2017 (15.9.28307.1500) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: C:\Files\Dev\test1\node_modules\canvas\build\config.gypi      
npm ERR! gyp verb config.gypi checking for gypi file: C:\Files\Dev\test1\node_modules\canvas\config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: C:\Files\Dev\test1\node_modules\canvas\common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "msvs"
npm ERR! gyp info spawn C:\Python39\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\ekimm\\AppData\\Roaming\\nvm\\v16.15.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   'C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\ekimm\\AppData\\Roaming\\nvm\\v16.15.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\\ekimm\\AppData\\Local\\node-gyp\\Cache\\16.15.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\\ekimm\\AppData\\Local\\node-gyp\\Cache\\16.15.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\ekimm\\AppData\\Roaming\\nvm\\v16.15.1\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\ekimm\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\16.15.1\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Files\\Dev\\test1\\node_modules\\canvas',
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:\\Files\\Dev\\test1\\node_modules\\canvas\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'C:\\Users\\ekimm\\AppData\\Roaming\\nvm\\v16.15.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'build',
npm ERR! gyp verb cli   '--fallback-to-build',
npm ERR! gyp verb cli   '--update-binary',
npm ERR! gyp verb cli   '--module=C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\Release\\canvas.node',
npm ERR! gyp verb cli   '--module_name=canvas',
npm ERR! gyp verb cli   '--module_path=C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\Release',
npm ERR! gyp verb cli   '--napi_version=8',
npm ERR! gyp verb cli   '--node_abi_napi=napi',
npm ERR! gyp verb cli   '--napi_build_version=0',
npm ERR! gyp verb cli   '--node_napi_label=node-v93'
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.15.1 | win32 | x64
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir C:\Users\ekimm\AppData\Local\node-gyp\Cache\16.15.1
npm ERR! gyp verb found first Solution file build/binding.sln
npm ERR! gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe        
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'build/binding.sln',
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 Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\ekimm\AppData\Roaming\nvm\v16.15.1\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.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\\ekimm\\AppData\\Roaming\\nvm\\v16.15.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=C:\\Files\\Dev\\test1\\node_modules\\canvas\\build\\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
npm ERR! gyp ERR! cwd C:\Files\Dev\test1\node_modules\canvas
npm ERR! gyp ERR! node -v v16.15.1
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\ekimm\AppData\Roaming\nvm\v16.15.1\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --update-binary --module=C:\Files\Dev\test1\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Files\Dev\test1\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)     
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Files\Dev\test1\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.22000
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Files\\Dev\\test1\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd C:\Files\Dev\test1\node_modules\canvas
npm ERR! node-pre-gyp ERR! node -v v16.15.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
npm ERR! node-pre-gyp ERR! not ok
npm verb exit 1
npm timing npm Completed in 27446ms
npm verb unfinished npm timer reify 1660736321186
npm verb unfinished npm timer reify:build 1660736323250
npm verb unfinished npm timer build 1660736323251
npm verb unfinished npm timer build:deps 1660736323251
npm verb unfinished npm timer build:run:install 1660736323288
npm verb unfinished npm timer build:run:install:node_modules/canvas 1660736323289
npm verb code 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ekimm\AppData\Local\npm-cache\_logs\2022-08-17T11_38_41_029Z-debug-0.lo

@VasilNikolov
Copy link

Same issue here. I run npm install --buil-from-source.

info run canvas@2.9.3 install node_modules/canvas node-pre-gyp install --fallback-to-build --update-binary
1820 info run canvas@2.9.3 install { code: null, signal: 'SIGINT' }
1821 timing reify:rollback:createSparse Completed in 740ms
1822 timing reify:rollback:retireShallow Completed in 1ms
1823 timing command:i Completed in 238764ms
1824 verbose stack Error: command failed
1824 verbose stack at ChildProcess. (/usr/local/node/18.7.0/node-v18.7.0-linux-x64/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:63:27)
1824 verbose stack at ChildProcess.emit (node:events:513:28)
1824 verbose stack at maybeClose (node:internal/child_process:1091:16)
1824 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
1825 verbose pkgid canvas@2.9.3
1826 verbose cwd /home/commasense/private/wemakeit-api
1827 verbose Linux 5.15.59-sure
1828 verbose node v18.7.0
1829 verbose npm v8.15.0
1830 error path /home/commasense/private/wemakeit-api/node_modules/canvas
1831 error command failed
1832 error signal SIGINT
1833 error command sh /tmp/install-8dbbbffa.sh
1834 error node-pre-gyp info it worked if it ends with ok
1834 error node-pre-gyp info using node-pre-gyp@1.0.9
1834 error node-pre-gyp info using node@18.7.0 | linux | x64
1834 error node-pre-gyp info build requesting source compile
1835 verbose exit 1

@zhangxiaoshang

This comment was marked as off-topic.

@Xyvyrianeth

This comment was marked as off-topic.

@haskelcurry

This comment was marked as duplicate.

@zbjornson
Copy link
Collaborator

zbjornson commented Aug 30, 2022

@zhangxiaoshang @Xyvyrianeth those are different issues (#2025) than this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants