Does anyone know how to fix this issue when running the command "npm install -g triplie"? I also get the same error when installing sqlite3 only.
This is node.js compiled manually, as I can't find a version in apt-get to install.
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at maybeClose (child_process.js:999:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1071:5)
gyp ERR! System Linux 3.15.3-x86_64-linode44
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=sqlite3" "--configuration=Release" "--module_name=node_sqlite3" "--version=2.2.4" "--major=2" "--minor=2" "--patch=4" "--runtime=node" "--node_abi=node-v14" "--platform=linux" "--target_platform=linux" "--arch=x64" "--target_arch=x64" "--module_main=./lib/sqlite3" "--host=https://node-sqlite3.s3.amazonaws.com/" "--module_path=/usr/local/lib/node_modules/triplie/node_modules/sqlite3/lib/binding/node-v14-linux-x64" "--remote_path=./Release/" "--package_name=node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz" "--staged_tarball=build/stage/Release/node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz" "--hosted_path=https://node-sqlite3.s3.amazonaws.com/Release/" "--hosted_tarball=https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz"
gyp ERR! cwd /usr/local/lib/node_modules/triplie/node_modules/sqlite3
gyp ERR! node -v v0.11.14-pre
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node rebuild --name=sqlite3 --configuration=Release --module_name=node_sqlite3 --version=2.2.4 --major=2 --minor=2 --patch=4 --runtime=node --node_abi=node-v14 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./lib/sqlite3 --host=https://node-sqlite3.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/triplie/node_modules/sqlite3/lib/binding/node-v14-linux-x64 --remote_path=./Release/ --package_name=node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz --staged_tarball=build/stage/Release/node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz --hosted_path=https://node-sqlite3.s3.amazonaws.com/Release/ --hosted_tarball=https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/triplie/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:999:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1071:5)
node-pre-gyp ERR! System Linux 3.15.3-x86_64-linode44
node-pre-gyp ERR! command "node" "/usr/local/lib/node_modules/triplie/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/triplie/node_modules/sqlite3
node-pre-gyp ERR! node -v v0.11.14-pre
node-pre-gyp ERR! node-pre-gyp -v v0.5.19
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node rebuild --name=sqlite3 --configuration=Release --module_name=node_sqlite3 --version=2.2.4 --major=2 --minor=2 --patch=4 --runtime=node --node_abi=node-v14 --platform=linux --target_platform=linux --arch=x64 --target_arch=x64 --module_main=./lib/sqlite3 --host=https://node-sqlite3.s3.amazonaws.com/ --module_path=/usr/local/lib/node_modules/triplie/node_modules/sqlite3/lib/binding/node-v14-linux-x64 --remote_path=./Release/ --package_name=node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz --staged_tarball=build/stage/Release/node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz --hosted_path=https://node-sqlite3.s3.amazonaws.com/Release/ --hosted_tarball=https://node-sqlite3.s3.amazonaws.com/Release/node_sqlite3-v2.2.4-node-v14-linux-x64.tar.gz' (1)
npm ERR! sqlite3#2.2.4 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#2.2.4 install script.
npm ERR! This is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.15.3-x86_64-linode44
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "triplie"
npm ERR! cwd /root/node
npm ERR! node -v v0.11.14-pre
npm ERR! npm -v 1.4.14
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/node/npm-debug.log
npm ERR! not ok code 0
I got the same error trying to install sqlite through npm for etherpad-lite. I checked out the 0.12 branch and rebuilt, and npm install sqlite3 ran with no errors. My etherpad is now using an sqlite database, hooray!
Related
I am trying to install canvas on my raspberry pi via npm after successfully installing on my main pc, but now I get a really long error that I don't know how to fix.
Here's the full error:
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/local/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 Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.15.32+
npm ERR! 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" "--update-binary" "--module=/home/alex/discord-bot/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/alex/discord-bot/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 /home/alex/discord-bot/node_modules/canvas
npm ERR! gyp ERR! node -v v16.16.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 '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/home/alex/discord-bot/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/alex/discord-bot/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> (/home/alex/discord-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:527:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1092: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 Linux 5.15.32+
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/home/alex/discord-bot/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /home/alex/discord-bot/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v16.16.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/alex/.npm/_logs/2022-08-09T20_08_23_632Z-debug-0.log
I used the command npm install --build-from-source canvas, please can I have help?
Try this before run npm install canvas. It work for me
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Ref : https://flaviocopes.com/fix-node-canvas-error-pre-gyp-macos/
Seems you're missing the 'pixman' dependency. Did you follow the guide to install all the needed dependencies before installing canvas? It requires a bunch of dependencies.
You have to install required dependencies for compiling your system from https://www.npmjs.com/package/canvas
For ubuntu i did
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
When I update Node js in my Linux machine (CentOS by nvm) the modules that have node-gyp and node-pre-gyp are disabled and need to be reinstalled, For example canvas, ursa, ...
i tested this solution:
I think delete this directory and clean the cache of npm is better:
rm -rf ~/.node-gyp/
rm -r node_modules/.bin/;
rm -r build/
npm cache clean
and test
npm uninstall node-gyp
npm install -g node-gyp
and
npm uninstall node-pre-gyp
npm install -g node-pre-gyp
finally:
npm install <your module>
But these two modules go wrong and the installation process is over from package.json. what can i do with this errors?
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/root/.nvm/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 3.10.0-957.21.2.el7.x86_64
gyp ERR! command "/root/.nvm/v10.16.3/bin/node" "/root/.nvm/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/root/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/root/node_modules/canvas/build/Release" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64" "--python=python2.7"
gyp ERR! cwd /root/node_modules/canvas
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/root/.nvm/v10.16.3/bin/node /root/.nvm/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/root/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/root/node_modules/canvas/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64 --python=python2.7' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/root/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 3.10.0-957.21.2.el7.x86_64
node-pre-gyp ERR! command "/root/.nvm/v10.16.3/bin/node" "/root/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /root/node_modules/canvas
node-pre-gyp ERR! node -v v10.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/root/.nvm/v10.16.3/bin/node /root/.nvm/v10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/root/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/root/node_modules/canvas/build/Release --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64 --python=python2.7' (1)
npm WARN PartServer#6.2.0 No description
npm WARN PartServer#6.2.0 license should be a valid SPDX license expression
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas#2.6.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas#2.6.0 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! /root/.npm/_logs/2019-09-17T07_45_58_118Z-debug.log
I'm running Ubuntu 17.04
node version: 8.0.0
npm version: 5.3.0
node-gyp version: 3.6.2
csaba#titan:~/GitRepos/valleydevfest2017$ sudo npm install -g iltorb
> iltorb#1.3.5 install /usr/local/lib/node_modules/iltorb
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(undefined): https://github.com /MayhemYDG/iltorb/releases/download/1.3.5/node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for iltorb#1.3.5 and node#8.0.0 (node-v57 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local /lib/node_modules/iltorb/build'
gyp ERR! System Linux 4.10.0-28-lowlatency
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=/usr/local/lib/node_modules/iltorb/build/bindings/iltorb.node" "--module_name=iltorb" "--module_path=/usr/local/lib/node_modules/iltorb/build/bindings"
gyp ERR! cwd /usr/local/lib/node_modules/iltorb
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.6.2
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=/usr/local/lib/node_modules/iltorb/build/bindings/iltorb.node --module_name=iltorb --module_path=/usr/local/lib/node_modules/iltorb/build/bindings' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/iltorb/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:887:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
node-pre-gyp ERR! System Linux 4.10.0-28-lowlatency
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/iltorb/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/iltorb
node-pre-gyp ERR! node -v v8.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
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=/usr/local/lib/node_modules/iltorb/build/bindings/iltorb.node --module_name=iltorb --module_path=/usr/local/lib/node_modules/iltorb/build/bindings' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! iltorb#1.3.5 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the iltorb#1.3.5 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/csaba/.npm/_logs/2017-08-11T04_34_39_178Z-debug.log
Now firebase-tools doesn't work at all. I wish I stayed with v3.9.0.
Filed an issue: https://github.com/MayhemYDG/iltorb/issues/46
What can I do?
I had the same problem today, after reading many things and trying many things (e.g. sudo npm install -g gyp-node) nothing worked, untill I stumbled on NPM's unsafe-perm flag:
--unsafe-perm
WARNING: Use with care and read the documentation first
But it fixed my problem and hopefully yours too.
I am tring to execute fabcar example from Hyperledger-fabric where I have created few cars. When I try to execute
node query.js
at ../fabric-samples/fabcar I am getting an error
fabric-client not found
If I execute
npm install
I have node 6.9.0 and npm 3.10.0
I am getting error like this
> grpc#1.2.4 install /home/.../fabric-samples/fabcar/node_modules/grpc
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.2.4/node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc#1.2.4 and node#8.0.0 (node-v57 ABI) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/8.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/.../fabric-samples/fabcar/node_modules/grpc/.node-gyp"
make: Entering directory '/home/.../fabric-samples/fabcar/node_modules/grpc/build'
make: *** No rule to make target '../.node-gyp/8.0.0/include/node/common.gypi', needed by 'Makefile'. Stop.
make: Leaving directory '/home/.../fabric-samples/fabcar/node_modules/grpc/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Linux 4.4.0-42-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/.../fabric-samples/fabcar/node_modules/grpc/src/node/extension_binary/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/.../fabric-samples/fabcar/node_modules/grpc/src /node/extension_binary"
gyp ERR! cwd /home/.../fabric-samples/fabcar/node_modules/grpc
gyp ERR! node -v v8.0.0
gyp ERR! node-gyp -v v3.3.1
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 build --fallback-to-build --module=/home/.../fabric-samples/fabcar/node_modules/grpc/src/node/extension_binary/grpc_node.node
--module_name=grpc_node --module_path=/home/.../fabric-samples/fabcar/node_modules/grpc/src/node/extension_binary' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/.../fabric-samples/fabcar/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:887:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:208:5)
node-pre-gyp ERR! System Linux 4.4.0-42-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/.../fabric-samples/fabcar/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/.../fabric-samples/fabcar/node_modules/grpc
node-pre-gyp ERR! node -v v8.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.34
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 build --fallback-to-build --module=/home/.../fabric-samples/fabcar/node_modules/grpc/src/node/extension_binary/grpc_node.node --module_name=grpc_node --module_path=/home/.../fabric-samples/fabcar/node_modules/grpc/src /node/extension_binary' (1)
fabcar#1.0.0 /home/.../fabric-samples/fabcar`-- (empty)
npm WARN fabcar#1.0.0 No repository field.
npm ERR! Linux 4.4.0-42-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v8.0.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! grpc#1.2.4 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc#1.2.4 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the grpc package
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs grpc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls grpc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/.../fabric-samples/fabcar/npm-debug.log
npm ERR! code 1
can anyone help me to execute the code
It was solved after deleting directory node_module and then doing
npm install
I'm running raspbian on my raspberry pi 3. I'm trying to install the serialport module and many errors show up.
pi#raspberrypi:~/pmsensor $ sudo npm install --save serialport --fix-missing
This is what i get:
serialport#4.0.7 install /home/pi/pmsensor/node_modules/serialport
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.7/serialport-v4.0.7-node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport#4.0.7 and node#6.9.5 (node-v48 ABI) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/pmsensor/node_modules/serialport/.node-gyp"
make: Entering directory '/home/pi/pmsensor/node_modules/serialport/build'
make: *** No rule to make target '../.node-gyp/6.9.5/include/node/common.gypi', needed by 'Makefile'. Stop.
make: Leaving directory '/home/pi/pmsensor/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.48-v7+
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/pi/pmsensor/node_modules/serialport/build/Release/serialport.node" "--module_name=serialport" "--module_path=/home/pi/pmsensor/node_modules/serialport/build/Release"
gyp ERR! cwd /home/pi/pmsensor/node_modules/serialport
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pi/pmsensor/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/pmsensor/node_modules/serialport/build/Release' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/pmsensor/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.48-v7+
node-pre-gyp ERR! command "/usr/bin/nodejs" "/home/pi/pmsensor/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/pmsensor/node_modules/serialport
node-pre-gyp ERR! node -v v6.9.5
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/pi/pmsensor/node_modules/serialport/build/Release/serialport.node --module_name=serialport --module_path=/home/pi/pmsensor/node_modules/serialport/build/Release' (1)
npm WARN pmsensor#1.0.0 No repository field.
npm ERR! Linux 4.4.48-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--save" "serialport" "--fix-missing"
npm ERR! node v6.9.5
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! serialport#4.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport#4.0.7 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs serialport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/pmsensor/npm-debug.log
You correctly figured out how to solve this. With the raspberry pi people usually run as root (as you are) and if you want to install a binary package with root (maybe any package), you need to use the --unsafe-perm flag with npm. The node serialport docs have more information.
https://github.com/EmergingTechnologyAdvisors/node-serialport#sudo--root