I'm running this code and sometimes I get it to work other times it fails.

Its build by node (not by me ofcourse)

When I run it I often get package not found so I install it and then I get this error?

It's like it's not letting me install the node packages.

  throw err;

Error: Cannot find module 'node-schedule'
Require stack:
- /home/pi/Tools-for-Instagram/bots/hashtagcount1.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/home/pi/Tools-for-Instagram/bots/hashtagcount1.js:2:16)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  requireStack: [ '/home/pi/Tools-for-Instagram/bots/hashtagcount1.js' ]
pi@raspberrypi:~/Tools-for-Instagram $ npm install node-schedule

> [email protected] install /home/pi/Tools-for-Instagram/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download 
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-v72-linux-glibc-arm.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
Package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.19.97-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/Tools-for-Instagram/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/pi/Tools-for-Instagram/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/pi/Tools-for-Instagram/node_modules/canvas
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/Tools-for-Instagram/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/Tools-for-Instagram/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/Tools-for-Instagram/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.19.97-v7+
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/Tools-for-Instagram/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/Tools-for-Instagram/node_modules/canvas
node-pre-gyp ERR! node -v v12.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/Tools-for-Instagram/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/Tools-for-Instagram/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.

npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-06-28T15_05_27_886Z-debug.log

2 Answers 2


The node-canvas-prebuilt has been deprecated going by the notes on GitHub.


npm install --save canvas

then try the schedule import.

Thing that has me baffled is that node-schedule does not list this as a dependency based on its package docs!?!


What you see is that it fails to find a prebuilt package matching your required versions and falls back to trying to compile it. I guess sometimes it can work on other setups because it will need other versions depending on what you have installed.
Here, somehow, the compilation fails.

I also struggled with the 'canvas' module not wanting to be installed/compiled and found out from the module's documentation that you would need the following dependencies in order to build it:

libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

So if you are on a Raspberry Pi, assuming you are running Raspbian aka Raspberry Pi OS, you can install the needed packages for compilation like this:

sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

Hopefully now when you try to install that module, after failing to find the correct version, it will successfully compile it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.