I am facing issues while deploying my project to ElasticBeanStalk there is node-pre-gyp --fallback-to-build error while installing canvas 2.7.0 module.
I am not sure this is permission error which is metion as
Error: EACCES: permission denied, mkdir '/var/app/staging/node_modules/@tensorflow/tfjs-node/deps'
Here my error in eb-engine.log
> canvas@2.6.1 install /var/app/staging/node_modules/canvas
> node-pre-gyp install --fallback-to-build
Failed to execute '/opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/var/app/staging/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/var/app/staging/node_modules/canvas/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
2021/04/29 17:18:19.518886 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --production install failed with error exit status 1. Stderr:(node:3446) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/var/app/staging/node_modules/@tensorflow/tfjs-node/deps'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3446) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3446) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.6.1 and node@14.16.0 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/var/app/staging/node_modules/canvas/build'
gyp WARN EACCES current user ("healthd") does not have permission to access the dev dir "/root/.cache/node-gyp/14.16.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/var/app/staging/node_modules/canvas/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/app/staging/node_modules/canvas/.node-gyp'
gyp ERR! System Linux 4.14.225-169.362.amzn2.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/var/app/staging/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/var/app/staging/node_modules/canvas/build/Release" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /var/app/staging/node_modules/canvas
gyp ERR! node -v v14.16.0
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 '/opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/var/app/staging/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/var/app/staging/node_modules/canvas/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/var/app/staging/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Linux 4.14.225-169.362.amzn2.x86_64
node-pre-gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v14.16.0-linux-x64/bin/node" "/var/app/staging/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /var/app/staging/node_modules/canvas
node-pre-gyp ERR! node -v v14.16.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
npm WARN only4laugh@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I have also mention node and npm version in my package.json, and added into .npmrc file too
"engines": {
"node": ">=8.12.0",
"npm": ">=6.0.0"
}