gyp ERR! stack Error: Cannot find module 'psl' - javascript

I'm trying to run an existing project but I keep getting this error:
error logs image
when I try to run "npm i", can someone please explain what this error is about or guide me through the steps to solve it?
TIA
in case you can't see the logs:
npm ERR! code 7
npm ERR! path C:\Users\Kumail\Documents\XORD\alon\alon\node_modules\tree-sitter-c
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#14.17.6 | win32 | x64
npm ERR! gyp info find Python using Python version 3.7.3 found at "C:\Users\Kumail\Anaconda3\python.exe"
npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! gyp ERR! stack Error: Cannot find module 'psl'
npm ERR! gyp ERR! stack Require stack:
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\tough-cookie\lib\pubsuffix-psl.js
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\tough-cookie\lib\cookie.js
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\request\lib\cookies.js
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\request\index.js
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\install.js
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\node-gyp.js
npm ERR! gyp ERR! stack - C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
npm ERR! gyp ERR! stack at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
npm ERR! gyp ERR! stack at Function.Module._load (internal/modules/cjs/loader.js:745:27)
npm ERR! gyp ERR! stack at Module.require (internal/modules/cjs/loader.js:961:19)
npm ERR! gyp ERR! stack at require (internal/modules/cjs/helpers.js:92:18)
npm ERR! gyp ERR! stack at Object. (C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\tough-cookie\lib\pubsuffix-psl.js:32:11)
npm ERR! gyp ERR! stack at Module._compile (internal/modules/cjs/loader.js:1072:14)
npm ERR! gyp ERR! stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
npm ERR! gyp ERR! stack at Module.load (internal/modules/cjs/loader.js:937:32)
npm ERR! gyp ERR! stack at Function.Module._load (internal/modules/cjs/loader.js:778:12)
npm ERR! gyp ERR! stack at Module.require (internal/modules/cjs/loader.js:961:19)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Kumail\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Kumail\Documents\XORD\alon\alon\node_modules\tree-sitter-c
npm ERR! gyp ERR! node -v v14.17.6
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! Node-gyp failed to build your package.
npm ERR! gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the package author.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Kumail\AppData\Local\npm-cache_logs\2021-11-08T10_21_18_719Z-debug.log

I can't comment because I don't have enough reputation but try running npm install psl and then npm install because the error mentions a package called psl doesn't exist when the code is asking for it. It could be a missing dependency for one of the libraries you have. Let me know how that goes :)

Related

Cant install frpc tools package

when I'm trying to install grpc-tools I get this massive error:
I really don't know what to do
npm ERR! win_delay_load_hook.cc npm ERR! z.vcxproj -> F:\NodeJS Projects\Noosa\npg\node_modules\grpc\build\Release\\libz.lib
npm ERR! Failed to execute 'F:\Node js\node.exe C:\Users\Lidor
German\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
build --fallback-to-build --library=static_library --module=F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown\grpc_node.node
--module_name=grpc_node --module_path=F:\NodeJS Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown
--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 info using
node-pre-gyp#0.14.0 npm ERR! node-pre-gyp info using node#16.17.0 |
win32 | x64 npm ERR! node-pre-gyp WARN Using request for node-pre-gyp
https download npm ERR! node-pre-gyp info check checked for "F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown\grpc_node.node"
(not found) npm ERR! node-pre-gyp http GET
https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp http 404
https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404):
https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-win32-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for
grpc#1.24.2 and node#16.17.0 (node-v93 ABI, unknown) (falling back to
source compile with node-gyp) npm ERR! node-pre-gyp http 404 status
code downloading tarball
https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-win32-x64-unknown.tar.gz
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#16.17.0 | win32 | x64 npm
ERR! gyp info ok 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#16.17.0 | win32 | x64 npm ERR! gyp info find Python using Python
version 3.10.6 found at "C:\Users\Lidor
German\AppData\Local\Programs\Python\Python310\python.exe" 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 info spawn C:\Users\Lidor
German\AppData\Local\Programs\Python\Python310\python.exe npm ERR! gyp
info spawn args [ npm ERR! gyp info spawn args 'C:\Users\Lidor
German\AppData\Roaming\npm\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 'F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\build\config.gypi', npm
ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args
'C:\Users\Lidor
German\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args
'C:\Users\Lidor
German\AppData\Local\node-gyp\Cache\16.17.0\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\Lidor
German\AppData\Local\node-gyp\Cache\16.17.0', npm ERR! gyp info
spawn args '-Dnode_gyp_dir=C:\Users\Lidor
German\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\Lidor
German\\AppData\\Local\\node-gyp\\Cache\\16.17.0\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=F:\NodeJS
Projects\Noosa\npg\node_modules\grpc', 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
'F:\NodeJS Projects\Noosa\npg\node_modules\grpc\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 info using node-gyp#9.1.0 npm ERR! gyp info using
node#16.17.0 | win32 | x64 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 '/clp:Verbosity=minimal', 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\Lidor
German\AppData\Roaming\npm\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 Process.ChildProcess._handle.onexit
(node:internal/child_process:291:12) npm ERR! gyp ERR! System
Windows_NT 10.0.19044 npm ERR! gyp ERR! command "F:\Node
js\node.exe" "C:\Users\Lidor
German\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
"build" "--fallback-to-build" "--library=static_library"
"--module=F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown\grpc_node.node"
"--module_name=grpc_node" "--module_path=F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown"
"--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0"
"--node_napi_label=node-v93" npm ERR! gyp ERR! cwd F:\NodeJS
Projects\Noosa\npg\node_modules\grpc npm ERR! gyp ERR! node -v
v16.17.0 npm ERR! gyp ERR! node-gyp -v v9.1.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 'F:\Node js\node.exe C:\Users\Lidor
German\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js
build --fallback-to-build --library=static_library --module=F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown\grpc_node.node
--module_name=grpc_node --module_path=F:\NodeJS Projects\Noosa\npg\node_modules\grpc\src\node\extension_binary\node-v93-win32-x64-unknown
--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. (F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit
(node:events:513:28) npm ERR! node-pre-gyp ERR! stack at
maybeClose (node:internal/child_process:1093: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.19044 npm ERR! node-pre-gyp ERR! command "F:\Node
js\node.exe" "F:\NodeJS
Projects\Noosa\npg\node_modules\grpc\node_modules\node-pre-gyp\bin\node-pre-gyp"
"install" "--fallback-to-build" "--library=static_library" npm ERR!
node-pre-gyp ERR! cwd F:\NodeJS Projects\Noosa\npg\node_modules\grpc
npm ERR! node-pre-gyp ERR! node -v v16.17.0 npm ERR! node-pre-gyp ERR!
node-pre-gyp -v v0.14.0 npm ERR! node-pre-gyp ERR! not ok npm ERR! A
complete log of this run can be found in: npm ERR! C:\Users\Lidor
German\AppData\Local\npm-cache_logs\2022-09-05T08_30_41_064Z-debug-0.log
That error is a failure to install the grpc package. That package is deprecated, and is not compatible with Node 16. That dependency should be replaced with #grpc/grpc-js.

is it possible to install canvas with M1 chip

When I run this command in MacBook Pro M1 to install canvas:
npm install --save-dev canvas
shows error:
npm ERR! code 1
npm ERR! path /Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/bin/node /Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/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 info using node-pre-gyp#1.0.8
npm ERR! node-pre-gyp info using node#16.13.2 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas/build/Release/canvas.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.9.0/canvas-v2.9.0-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.9.0/canvas-v2.9.0-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas#2.9.0 and node#16.13.2 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.9.0/canvas-v2.9.0-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.3.0
npm ERR! gyp info using node#16.13.2 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.3.0
npm ERR! gyp info using node#16.13.2 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.1 found at "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/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 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/xiaoqiangjiang/Library/Caches/node-gyp/16.13.2/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=/Users/xiaoqiangjiang/Library/Caches/node-gyp/16.13.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/xiaoqiangjiang/Library/Caches/node-gyp/16.13.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/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 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
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
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 21.3.0
npm ERR! gyp ERR! command "/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/bin/node" "/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/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 /Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v8.3.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 '/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/bin/node /Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/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> (/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/#mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.3.0
npm ERR! node-pre-gyp ERR! command "/Users/xiaoqiangjiang/.nvm/versions/node/v16.13.2/bin/node" "/Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/xiaoqiangjiang/source/reddwarf/frontend/js-wheel/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v16.13.2
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.8
npm ERR! node-pre-gyp ERR! not ok
does anyone facing the same problem. what should I to to fix it or avoid this problem? The node version is 16.x. I have already tried to install pkgconfig like this:
brew install pkgconfig
I finally found before install cavas in macOS, we need to install some dependencies using brew like this:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
then run the install command again will success. more info from the official document: https://github.com/Automattic/node-canvas

I get a bunch of errors when running npm install

I'm trying to get into full stack web dev, so I'm fairly new. Just recently I was installing node.js onto my laptop, I'm following this course and I had to clone a github repo onto my bash terminal and run the npm install but it came up with a whole list of errors.
I tried running things on a Virtual Environment, reinstalling node.js among some possible solutions online but with no luck. I'm hoping someone would help me out here, I'd appreciate that. Below is the log for my errors:
Thanks a lot
npm ERR! path C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
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\\Kevin\\OneDrive\\Desktop\\code\\javascript\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#16.5.0 | win32 | 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 []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:195:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python39\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:397:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Kevin\\OneDrive\\Desktop\\code\\javascript\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd C:\Users\Kevin\OneDrive\Desktop\code\javascript\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.5.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1```
It seems like this Node version requires Python 2x and you have Python 3x added to the path. Try downloading Python 2x and adding it to the path.

when I clone the code from git and run npm install on the machine, the error is like this. please help me

when I clone the code from git and run npm install on the machine, the error is like this. please help me
npm ERR! code 1
npm ERR! path C:\Users\ADMIN\Desktop\weather_app\complete-node-bootcamp\4-natours\after-section-14\node_modules\deasync
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node ./build.js
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#3.8.0
npm ERR! gyp info using node#14.15.4 | win32 | x64
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
npm ERR! gyp ERR! stack at PythonFinder.failNoPython (C:\Users\ADMIN\node_modules\node-gyp\lib\configure.js:484:19)
npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (C:\Users\ADMIN\node_modules\node-gyp\lib\configure.js:509:16)
npm ERR! gyp ERR! stack at callback (C:\Users\ADMIN\node_modules\graceful-fs\polyfills.js:299:20)
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (fs.js:183:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ADMIN\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\ADMIN\Desktop\weather_app\complete-node-bootcamp\4-natours\after-section-14\node_modules\deasync
npm ERR! gyp ERR! node -v v14.15.4
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ADMIN\AppData\Local\npm-cache\_logs\2021-07-03T16_30_43_130Z-debug.log

How can I ovecome this error in npm install?

I'm a beginner programmer, and I'm making a discord bot using node and discord.js. I need a library named canvas, but it doesn't install!
I programmed and tested this app on my windows pc, then sent it over to my raspberry server. It didn't work, so I tried deleting and installing the library again, but when installing, it gives this error:
(I'm trying to install it with this command: npm install canvas)
npm ERR! code 1
npm ERR! path /home/pi/node/test/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node/test/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/node/test/node_modules/canvas/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v88' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp#0.11.0
npm ERR! node-pre-gyp info using node#15.0.1 | linux | arm
npm ERR! node-pre-gyp WARN Using needle for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "/home/pi/node/test/node_modules/canvas/build/Release/canvas.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-linux-glibc-arm.tar.gz
npm ERR! node-pre-gyp http 404 https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-linux-glibc-arm.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-linux-glibc-arm.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for canvas#2.6.1 and node#15.0.1 (node-v88 ABI, glibc) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 404 status code downloading tarball https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v88-linux-glibc-arm.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#15.0.1 | linux | arm
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#15.0.1 | linux | arm
npm ERR! gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/lib/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 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/pi/node/test/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/pi/.cache/node-gyp/15.0.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=/home/pi/.cache/node-gyp/15.0.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/pi/.cache/node-gyp/15.0.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/pi/node/test/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 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package pixman-1 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `pixman-1.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'pixman-1' found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:327:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
npm ERR! gyp ERR! System Linux 5.4.51-v7l+
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/node/test/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/pi/node/test/node_modules/canvas/build/Release" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v88"
npm ERR! gyp ERR! cwd /home/pi/node/test/node_modules/canvas
npm ERR! gyp ERR! node -v v15.0.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
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 '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/node/test/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/node/test/node_modules/canvas/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v88' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/node/test/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:327:20)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1048:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
npm ERR! node-pre-gyp ERR! System Linux 5.4.51-v7l+
npm ERR! node-pre-gyp ERR! command "/usr/bin/node" "/home/pi/node/test/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /home/pi/node/test/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v15.0.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pi/.npm/_logs/2020-10-27T20_10_02_765Z-debug.log```
First Try installing the binaries for canvas mentioned in https://github.com/Automattic/node-canvas
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
Then install canvas:
npm install canvas
Did you start by running npm init? I would assume so because of the node_modules folder mentioned in the error, but just checking.
You can install it with homebrew using:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
according to the docs here: https://github.com/Automattic/node-canvas
Works for me on Macbook M1 Pro ->
arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg

Categories