node.js – node-pre-gyp ERR! Railway app failed. Npm error

I hosted my app on railway and it was working perfectly but yesterday it thrown an error of npm. I can’t understand what’s that and how can solve. I don’t know why this came. I didn’t commit anything that cause this error. I just updated the index.html of the app and when I update it, It thrown this npm error. I tried a lot to fix this but couldn’t.

- yj
 
npm
WARN config production Use `--omit=dev` instead.
 
Using npm v8.9.0 from Node
 
Installing node modules
 
npm
WARN config production Use `--omit=dev` instead.
 
npm
WARN config production Use `--omit=dev` instead.
 
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
 
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
 
npm WARN deprecated @types/bson@4.2.0: This is a stub types definition. bson provides its own type definitions, so you do not need this installed.
 
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 deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
 
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
 
npm WARN deprecated scrape-yt@1.4.8: Use youtubei instead (https://github.com/SuspiciousLookingOwl/youtubei#readme), it has more features, less buggy, and faster.
 
npm notice
npm notice New minor version of npm available! 8.9.0 -> 8.10.0
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.10.0>;
npm notice Run `npm install -g npm@8.10.0` to update!
npm notice
 
npm ERR! code 1
npm ERR! path /workspace/node_modules/canvas
 
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
 
npm ERR! Failed to execute '/layers/heroku_nodejs-engine/dist/bin/node /layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/workspace/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/workspace/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.2.0 | linux | x64
npm ERR!
node-pre-gyp info check checked for "/workspace/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.1/canvas-v2.9.1-node-v108-linux-glibc-x64.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.1/canvas-v2.9.1-node-v108-linux-glibc-x64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.9.1 and node@18.2.0 (node-v108 ABI, glibc) (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.1/canvas-v2.9.1-node-v108-linux-glibc-x64.tar.gz
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.2.0 | linux | 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.2.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.10 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.2.0/node-v18.2.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.2.0/node-v18.2.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v18.2.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.2.0/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR!
gyp info spawn args [
npm ERR! gyp info spawn args   '/layers/heroku_nodejs-engine/dist/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   '/workspace/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/heroku/.cache/node-gyp/18.2.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=/home/heroku/.cache/node-gyp/18.2.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/heroku/.cache/node-gyp/18.2.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/workspace/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 pangocairo was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `pangocairo.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'pangocairo' found
npm ERR! gyp: Call to 'pkg-config pangocairo --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 (/layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm
ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR!
gyp ERR! System Linux 5.10.0-13-cloud-amd64
npm ERR! gyp ERR! command "/layers/heroku_nodejs-engine/dist/bin/node" "/layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/workspace/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/workspace/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 /workspace/node_modules/canvas
npm ERR!
gyp ERR! node -v v18.2.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 '/layers/heroku_nodejs-engine/dist/bin/node /layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/workspace/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/workspace/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> (/workspace/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:1090: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 Linux 5.10.0-13-cloud-amd64
npm ERR! node-pre-gyp ERR! command "/layers/heroku_nodejs-engine/dist/bin/node" "/workspace/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR!
node-pre-gyp ERR! cwd /workspace/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v18.2.0
gyp ERR! node -v v18.2.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 '/layers/heroku_nodejs-engine/dist/bin/node /layers/heroku_nodejs-engine/dist/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/workspace/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/workspace/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> (/workspace/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:1090: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 Linux 5.10.0-13-cloud-amd64
npm ERR! node-pre-gyp ERR! command "/layers/heroku_nodejs-engine/dist/bin/node" "/workspace/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR!
node-pre-gyp ERR! cwd /workspace/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v18.2.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!     /home/heroku/.npm/_logs/2022-05-25T04_28_06_162Z-debug-0.log
 
ERROR: failed to build: exit status 1
 
ERROR: failed to build: executing lifecycle: failed with status code: 51

I was deloying it to heroku before.

Leave a Comment