Stack Exchange
npm ERR! code 1 cannot install nodemodule
npm ERR! code 1
npm ERR! path D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c C:\Users\user\AppData\Local\Temp\install-d7cdc73b.cmd
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (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.9
npm ERR! node-pre-gyp info using node@18.10.0 | win32 | x64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-win32-unknown-x64.tar.gz
npm ERR! node-pre-gyp ERR! install request to https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-win32-unknown-x64.tar.gz failed, reason: getaddrinfo ENOTFOUND github.com
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.9.3 and node@18.10.0 (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error request to https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-win32-unknown-x64.tar.gz failed, reason: getaddrinfo ENOTFOUND github.com
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@18.10.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.0.0
npm ERR! gyp info using node@18.10.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe"     
npm ERR! gyp http GET https://nodejs.org/download/release/v18.10.0/node-v18.10.0-headers.tar.gz
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and
npm ERR! gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad
npm ERR! gyp ERR! stack network settings.
npm ERR! gyp ERR! stack     at go (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\install.js:173:17)        
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR! gyp ERR! stack     at async install (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\install.js:87:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=D:\\Neneng\\a) Neneng_Pribadi File\\2] Raynar abiyu diera\\Rays DEV\\Atomic BOT\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=D:\\Neneng\\a) Neneng_Pribadi File\\2] Raynar abiyu diera\\Rays DEV\\Atomic BOT\\node_modules\\canvas\\build\\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas
npm ERR! gyp ERR! node -v v18.10.0
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\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
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:1091:16)
npm ERR! node-pre-gyp ERR! stack     at 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" "D:\\Neneng\\a) Neneng_Pribadi File\\2] Raynar abiyu diera\\Rays DEV\\Atomic BOT\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd D:\Neneng\a) Neneng_Pribadi File\2] Raynar abiyu diera\Rays DEV\Atomic BOT\node_modules\canvas
npm ERR! node-pre-gyp ERR! node -v v18.10.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Local\npm-cache\_logs\2022-09-30T11_42_19_512Z-debug-0.log 


try this ,  npm install -g node-modules

Can you visit GitHub.com? Is it blocked for some reason?

You could try this answer. Cleaning the cache of your NPM folder

You seem to be offline or you have a bad DNS.

@Harshad.N How is that package being globally available related at all?

Does this answer your question? Cannot npm install canvas [NodeJs on Windows]?

The key error there is:
ERR! install request to https://github.com/Automattic/node-canvas/releases/download/v2.9.3/canvas-v2.9.3-node-v108-win32-unknown-x64.tar.gz failed, reason: getaddrinfo ENOTFOUND github.com
If we go to that repo:
https://github.com/Automattic/node-canvas/releases/tag/v2.9.3
There is no node-v108 there.

Someone already request it, and there is a workaround:
https://github.com/Automattic/node-canvas/issues/2025#issuecomment-1112543373

Each OS failed for a different reason. This will take a while to fix weary. Please follow the README for instructions on building from source meanwhile. https://github.com/Automattic/node-canvas#compiling


https://github.com/Automattic/node-canvas/issues/2052#issuecomment-1157912610

We don't have prebuilds available yet for Node 18, and unfortunately a lot has to happen to make them, see #2025(https://github.com/Automattic/node-canvas/issues/2025) . Until then, this module has to be built from source following https://github.com/Automattic/node-canvas#compiling. If you have troubles compiling, please open a separate issue.


But shouldn't this fail on an HTTP level then and not a DNS level? The error is from getaddrinfo.

@CherryDT I fail to see how is that relevant to the question, if you want you can ask a new question with that...

Well if the error fails to resolve the hostname github.com, what exists or does not exist on there won't matter. So even if we now get an existing file URL, as long as the domain doesn't even resolve, it won't change anything...

@CherryDT if he could not resolve github.com the errors will be different ... you can try to reproduce the issue yourself ... create an nodejs project with node -v v18.10.0 and add package Automattic/node-canvas and you will get that error  _ _ _ I do get your point, it is a misleading error message, but most error messages are like that

Thanks. I've been at it for hours... I guess I need to start reading better the errors.. One more thing to take notice! See if there is a compatible version of the package that is failing...
Again, thank you!

@lemario you are very welcome, Don't forget to upvote those answers you find useful.
