npm install sqlite3 error on arm - node.js

I am trying to install node package 'sqlite3' on linux based arm processor. I get error when I try to install the package. However if I try installing the same package on ubuntu, it goes through.
I am using Linux Kernel 3.14.52-v2.6b2+g7c83cef on the arm processor.
The command I use for sqlite3 installation is npm install sqlite3. I did try this link but of no use.
I get a different error
root#colibri-imx6:~# npm install sqlite3
-\|-\
> sqlite3#3.1.8 install /home/root/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v14-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.8 and node#0.12.7 (node-v14 ABI) (falling back to source compile with node-gyp
make: Entering directory '/home/root/node_modules/sqlite3/build'
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c
TOUCH Release/obj.target/deps/action_before_build.stamp
CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o
make: cc: Command not found
deps/sqlite3.target.mk:117: recipe for target 'Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o' failed
make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o] Error 127
make: Leaving directory '/home/root/node_modules/sqlite3/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:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Linux 3.14.52-v2.6b2+g7c83cef
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/h"
gyp ERR! cwd /home/root/node_modules/sqlite3
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallb)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/root/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:110:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:1015:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
node-pre-gyp ERR! System Linux 3.14.52-v2.6b2+g7c83cef
node-pre-gyp ERR! command "node" "/home/root/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/root/node_modules/sqlite3
node-pre-gyp ERR! node -v v0.12.7
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/roo)
npm ERR! Linux 3.14.52-v2.6b2+g7c83cef
npm ERR! argv "node" "/usr/bin/npm" "install" "sqlite3"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! sqlite3#3.1.8 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#3.1.8 install script 'node-pre-gyp install --fallback-to-build'.
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! Please include the following file with any support request:
npm ERR! /home/root/npm-debug.log
root#colibri-imx6:~#
I installed python-compiler, python-modules, and now gcc to take care of cc command but nothing is working. Has anyone encountered this problem ?

It may be because your arm based processor don't have a C compiler (usually gcc for linux) bundled with the OS...
The debug log tells that the packages fails on compiling native sources.
I can't tell you this is the cause for sure but you should give a try on that way !

I installed node sqlite3 on ubuntu arm64 successfully with
sudo apt install python
That’s because node-sqlite3 need python2 to compile.
Ubuntu use python3 by default.

Related

node-libcurl installation fails on MacOS Catalina: clang: error: no such file or directory: '/usr/include'

I simply wanted to install insomnia-inso on a Mac (Catalina) which has a dependency to node-libcurl and got the following error:
npm install -g node-libcurl
> node-libcurl#2.2.0 install /Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
CXX(target) Release/obj.target/node_libcurl/src/node_libcurl.o
clang: error: no such file or directory: '/usr/include'
make: *** [Release/obj.target/node_libcurl/src/node_libcurl.o] Error 1
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:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:327:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:277:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/Cellar/node/15.1.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl/lib/binding/node_libcurl.node" "--module_name=node_libcurl" "--module_path=/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl/lib/binding" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v88"
gyp ERR! cwd /Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl
gyp ERR! node -v v15.1.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 '/usr/local/Cellar/node/15.1.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl/lib/binding --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v88' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (node:events:327:20)
node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1055:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
node-pre-gyp ERR! System Darwin 19.6.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/15.1.0/bin/node" "/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl
node-pre-gyp ERR! node -v v15.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.15.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/15.1.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl/lib/binding/node_libcurl.node --module_name=node_libcurl --module_path=/Users/jonashecht/dev/spring-boot/spring-boot-openapi-kong/node_modules/node-libcurl/lib/binding --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v88' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-libcurl#2.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-libcurl#2.2.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! /Users/jonashecht/.npm/_logs/2020-11-05T08_43_46_342Z-debug.log
I installed node via homebrew with brew install node. Versions are is:
node --version
v15.1.0
npm --version
6.14.8
The problem comes from newer versions of Xcode command line tools on recent MacOS versions.
The crucial part in the log is:
CXX(target) Release/obj.target/node_libcurl/src/node_libcurl.o
clang: error: no such file or directory: '/usr/include'
make: *** [Release/obj.target/node_libcurl/src/node_libcurl.o] Error 1
As the node-libcurl docs state:
newer versions of the Command Line Tools does not add the /usr/include
folder by default. Check Xcode 10 release notes for details.
To fix this, we need to tell npm install about the new location of /usr/include which is $(xcrun --show-sdk-path)/usr/include by setting the npm environment variable npm_config_curl_include_dirs like this:
npm_config_curl_include_dirs="$(xcrun --show-sdk-path)/usr/include" npm install -g node-libcurl
In my case where I wanted to install another npm library like insomnia-inso in the first place, you need to add both npm libraries to the command in order to do a successful installation:
npm_config_curl_include_dirs="$(xcrun --show-sdk-path)/usr/include" npm install -g node-libcurl insomnia-inso
Now the installation of insomnia-inso worked like a charm.

Cannot upgrade firebase-tools because dependency iltorb npm package fails to install

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.

Not able to execute fabcar demo in Hyperledger

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

Error installing Realm via npm: npm ERR! Failed at the realm#1.2.0 install script 'node-pre-gyp install --fallback-to-build'

I've found other issues regarding fallback to binary build for other node packages but none for Realm. I've tried some solutions from other scenarios such as:
removing /home/.node-gyp,
installing build-essential / installing libkrb5-dev,
removing node_modulesfrom project root and node-gyp and then doing a fresh npm install
Yet when I run npm install --save realm I get this error trace:
node-pre-gyp ERR! Tried to download(404): https://static.realm.io/node-pre-gyp/realm-v1.2.0-node-v51-linux-ia32.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for realm#1.2.0 and node#7.5.0 (node-v51 ABI) (falling back to source compile with node-gyp)
make: Entering directory `/home/..../node_modules/realm/build'
ACTION binding_gyp_vendored_realm_target_download_realm /home/..../node_modules/realm/vendor/realm-node
Downloading dependency: realm-node 2.4.0
Using cached realm-node from TMPDIR
Skipping the sync download because ENABLE_SYNC is false.
TOUCH Release/obj.target/vendored-realm.stamp
TOUCH Release/obj.target/realm-core.stamp
CXX(target) Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o
g++: error: unrecognized command line option ‘-std=c++14’
make: *** [Release/obj.target/object-store/src/object-store/src/binding_callback_thread_observer.o] Error 1
make: Leaving directory `/home/..../node_modules/realm/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:285:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:192:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-75-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/./node_modules/realm/compiled/node-v51_linux_ia32/realm.node" "--module_name=realm" "--module_path=/home/..../node_modules/realm/compiled/node-v51_linux_ia32"
gyp ERR! cwd /home/..../node_modules/realm
gyp ERR! node -v v7.5.0
gyp ERR! node-gyp -v v3.6.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 build --fallback-to-build --module=/home/..../node_modules/realm/compiled/node-v51_linux_ia32/realm.node --module_name=realm --module_path=/home/..../node_modules/realm/compiled/node-v51_linux_ia32' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/..../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:192:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:890: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.0-75-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/..../node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/..../node_modules/realm
node-pre-gyp ERR! node -v v7.5.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/..../node_modules/realm/compiled/node-v51_linux_ia32/realm.node --module_name=realm --module_path=/home/..../node_modules/realm/compiled/node-v51_linux_ia32' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! realm#1.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the realm#1.2.0 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 realm 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
I am using node version 7.5.0 and npm version 4.5.0.
I have the node-pre-gyp package.
What is going on?!
Try the following step by step,
Install the older version in the project folder
npm install --save realm#0.14.3
Open node_modules/realm/package.json and remove this line:
"postlink": "node_modules/realm/scripts/rnpm-postlink.js"
Link
react-native link realm
The solution was found here

Multiple errors while installing nodejs serialport module

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

Resources