cannot find module 'serialport' using Node.js and Johnny-Five - node.js

I tried using Johnny-five and node.js to run a script for, using Leap Motion Controls. now when i try to run the script it says: (Error: Cannot find module 'serialport') I tried npm install -g serial-port it goes through then give me lots of (err) codes in red . how can i fix this ?
D:>node robotarm.js
module.js:338
throw err;
^
Error: Cannot find module 'serialport'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Board.Serial.detect (D:\node_modules\johnny-five\lib\board.js:70:7)
at new Board (D:\node_modules\johnny-five\lib\board.js:303:23)
at Object.<anonymous> (D:\robotarm.js:90:9)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
#
then i try
D:>npm install serialport
it gives
npm WARN package.json github-url-from-git#1.1.1 No repository field.
npm http GET https://registry.npmjs.org/serialport
npm http 304 https://registry.npmjs.org/serialport
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/sf
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/sf
npm http 304 https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/wordwrap
npm http GET https://registry.npmjs.org/minimist
npm http 304 https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/minimist
> serialport#1.4.10 install D:\node_modules\serialport
> node-pre-gyp install --fallback-to-build
node-pre-gyp http GET https://node-serialport.s3.amazonaws.com/serialport/v1.4.1
0/Release/node-v14-win32-x64.tar.gz
node-pre-gyp http 404 https://node-serialport.s3.amazonaws.com/serialport/v1.4.1
0/Release/node-v14-win32-x64.tar.gz
node-pre-gyp http Pre-built binary not available for your system (falling back t
o source compile with node-gyp)
child_process: customFds option is deprecated, use stdio instead.
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (D:\node_modules\node-gyp\lib\configure.js:10
3:14)
gyp ERR! stack at D:\node_modules\node-gyp\lib\configure.js:64:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:99:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "D:\\node_modules\\
node-gyp\\bin\\node-gyp.js" "rebuild" "--name=serialport" "--configuration=Relea
se" "--module_name=serialport" "--version=1.4.10" "--major=1" "--minor=4" "--pat
ch=10" "--runtime=node" "--node_abi=node-v14" "--platform=win32" "--target_platf
orm=win32" "--arch=x64" "--target_arch=x64" "--module_main=./serialport" "--host
=https://node-serialport.s3.amazonaws.com/" "--module_path=D:\\node_modules\\ser
ialport\\build\\serialport\\v1.4.10\\Release\\node-v14-win32-x64" "--remote_path
=./serialport/v1.4.10/Release/" "--package_name=node-v14-win32-x64.tar.gz" "--st
aged_tarball=build\\stage\\serialport\\v1.4.10\\Release\\node-v14-win32-x64.tar.
gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.10/R
elease/" "--hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v
1.4.10/Release/node-v14-win32-x64.tar.gz"
gyp ERR! cwd D:\node_modules\serialport
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files (x86)\nodejs\
node.exe rebuild --name=serialport --configuration=Release --module_name=serialp
ort --version=1.4.10 --major=1 --minor=4 --patch=10 --runtime=node --node_abi=no
de-v14 --platform=win32 --target_platform=win32 --arch=x64 --target_arch=x64 --m
odule_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --modul
e_path=D:\node_modules\serialport\build\serialport\v1.4.10\Release\node-v14-win3
2-x64 --remote_path=./serialport/v1.4.10/Release/ --package_name=node-v14-win32-
x64.tar.gz --staged_tarball=build\stage\serialport\v1.4.10\Release\node-v14-win3
2-x64.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v
1.4.10/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serial
port/v1.4.10/Release/node-v14-win32-x64.tar.gz' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (D:\node_modules\serialp
ort\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:1008:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_proces
s.js:1080:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "node" "D:\\node_modules\\serialport\\node_modules\\no
de-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd D:\node_modules\serialport
node-pre-gyp ERR! node -v v0.12.0
node-pre-gyp ERR! node-pre-gyp -v v0.5.19
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files (x86)\nodejs\node.exe rebuild --name=serialp
ort --configuration=Release --module_name=serialport --version=1.4.10 --major=1
--minor=4 --patch=10 --runtime=node --node_abi=node-v14 --platform=win32 --targe
t_platform=win32 --arch=x64 --target_arch=x64 --module_main=./serialport --host=
https://node-serialport.s3.amazonaws.com/ --module_path=D:\node_modules\serialpo
rt\build\serialport\v1.4.10\Release\node-v14-win32-x64 --remote_path=./serialpor
t/v1.4.10/Release/ --package_name=node-v14-win32-x64.tar.gz --staged_tarball=bui
ld\stage\serialport\v1.4.10\Release\node-v14-win32-x64.tar.gz --hosted_path=http
s://node-serialport.s3.amazonaws.com/serialport/v1.4.10/Release/ --hosted_tarbal
l=https://node-serialport.s3.amazonaws.com/serialport/v1.4.10/Release/node-v14-w
in32-x64.tar.gz' (1)
npm ERR! serialport#1.4.10 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport#1.4.10 install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "serialport"
npm ERR! cwd D:\
npm ERR! node -v v0.12.0
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! D:\npm-debug.log
npm ERR! not ok code 0

It's telling you that the version you requested in not available as a pre-built binary for your platform. Serial port access is a low-level system thing, so such a module can't be written in pure Javascript.
As documented in the installation instructions for that module (skip down to "Installation special cases":
https://github.com/voodootikigod/node-serialport
You have to build the package on your machine. The module is written in C++, so you must install Visual Studio Express. The build scripts are written in Python, so you have to install Python. Or talk to the module creator and ask why he doesn't have binaries for your platform (he has a Gitter chat room).

Problem solved :)
If anyone else has it: install visual studio and python, then:
npm install serialport
cd node_modules/serialport
node-pre-gyp rebuild```

Related

How to "npm install" bcrypt on Windows 7

I've installed node.js v6.9.1 together with npm version 4.1.2 and I've already used this combination for some projects
Now I wanted to use the bcrypt npm package in my project, but the installation fails miserably
npm install bcrypt --save
I've also tried to run this command with admin priviledges, to no avail
This is the error I get
> bcrypt#1.0.2 install C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcry
pt
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcryp
t.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for bcrypt#1.0.2 and node#6.9.1 (
node-v48 ABI) (falling back to source compile with node-gyp)
C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt>if not defined npm_c
onfig_node_gyp (node "C:\Users\ttheiner\AppData\Roaming\npm\node_modules\npm\bin
\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node
"" clean )
C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt>if not defined npm_c
onfig_node_gyp (node "C:\Users\ttheiner\AppData\Roaming\npm\node_modules\npm\bin
\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback
-to-build --module=C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt\l
ib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\tthei
ner\NodeProjects\authtest\node_modules\bcrypt\lib\binding ) else (node "" confi
gure --fallback-to-build --module=C:\Users\ttheiner\NodeProjects\authtest\node_m
odules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path
=C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt\lib\binding )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at Object.failNoPython (C:\Users\ttheiner\AppData\Roaming\npm
\node_modules\npm\node_modules\node-gyp\lib\configure.js:454:19)
gyp ERR! stack at Object.<anonymous> (C:\Users\ttheiner\AppData\Roaming\npm\
node_modules\npm\node_modules\node-gyp\lib\configure.js:480:16)
gyp ERR! stack at C:\Users\ttheiner\AppData\Roaming\npm\node_modules\npm\nod
e_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ttheiner\\App
Data\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js"
"configure" "--fallback-to-build" "--module=C:\\Users\\ttheiner\\NodeProjects\\
authtest\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bc
rypt_lib" "--module_path=C:\\Users\\ttheiner\\NodeProjects\\authtest\\node_modul
es\\bcrypt\\lib\\binding"
gyp ERR! cwd C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallb
ack-to-build --module=C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcryp
t\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\tt
heiner\NodeProjects\authtest\node_modules\bcrypt\lib\binding' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\ttheiner\NodeP
rojects\authtest\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/chi
ld_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\tthe
iner\\NodeProjects\\authtest\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "in
stall" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcryp
t
node-pre-gyp ERR! node -v v6.9.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\
ttheiner\NodeProjects\authtest\node_modules\bcrypt\lib\binding\bcrypt_lib.node -
-module_name=bcrypt_lib --module_path=C:\Users\ttheiner\NodeProjects\authtest\no
de_modules\bcrypt\lib\binding' (1)
npm WARN authtest#1.0.0 No repository field.
npm WARN authtest#1.0.0 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ttheiner\\AppDat
a\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "bcrypt" "--save"
npm ERR! node v6.9.1
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#1.0.2 install script 'node-pre-gyp install --fallb
ack-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 bcrypt 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 bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\ttheiner\NodeProjects\authtest\npm-debug.log
The problem seems to be that npm cannot find pre-built binaries so it tries to compile the sources using python (which I don't seem to have).
Do I need to install python for this? If yes, can you point me in the right direction? Is it true that there is no pre-built version of bcrypt?
EDIT: After installing Python 2.7 the error changes... seems like it tries to use MSBuild to compile some C++ code.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsSDKDir var
iable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [C:\Users\ttheiner\NodeProject
s\authtest\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\ttheiner\NodeProjects\authtest\no
de_modules\bcrypt\build\bcrypt_lib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\ttheiner\AppData\Roaming\npm\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 Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ttheiner\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gy
p\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\ttheiner\\NodeProjects\\authtest\\node_modules\\bcrypt\\lib\\binding
\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\Users\\ttheiner\\NodeProjects\\authtest\\node_modules\\bcrypt\\lib\\binding
"
gyp ERR! cwd C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\ttheiner\NodeProjects\authtest\no
de_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\ttheiner\NodeProjects\authtest\node_modules\bc
rypt\lib\binding' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\ttheiner\NodeProjects\authtest\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 Windows_NT 6.1.7601
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ttheiner\\NodeProjects\\authtest\\node_modules\\node-pre-gyp\\bi
n\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt
node-pre-gyp ERR! node -v v6.9.1
node-pre-gyp ERR! node-pre-gyp -v v0.6.32
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt\lib\binding\b
crypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\ttheiner\NodeProjects\authtest\node_modules\bcrypt\lib\binding' (1)
npm WARN authtest#1.0.0 No repository field.
npm WARN authtest#1.0.0 No license field.
npm WARN Error: EPERM: operation not permitted, scandir 'C:\Users\ttheiner\NodeProjects\authtest\node_modules\dashdash\node_modules'
npm WARN at Error (native)
npm WARN { Error: EPERM: operation not permitted, scandir 'C:\Users\ttheiner\NodeProjects\authtest\node_modules\dashdash\node_modules'
npm WARN at Error (native)
npm WARN errno: -4048,
npm WARN code: 'EPERM',
npm WARN syscall: 'scandir',
npm WARN path: 'C:\\Users\\ttheiner\\NodeProjects\\authtest\\node_modules\\dashdash\\node_modules' }
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ttheiner\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "instal
l" "bcrypt" "--save"
npm ERR! node v6.9.1
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#1.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#1.0.2 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 bcrypt 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 bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\ttheiner\NodeProjects\authtest\npm-debug.log
I would suggest you use bcrypt-nodejs:
https://www.npmjs.com/package/bcrypt-nodejs
It provides almost the same functionality with easy usage.
Original answer:
Can you try the following:
Install Python (http://www.python.org/download/releases/2.7.5/)
Install Visual Studio 2012/13 Express (or other)
Install Windows SDK (for Windows 7 / 8)
Install Win64 OpenSSL v1.0.1g
Open "Developer Command Prompt for VS2012" as Administrator and test install
Then:
npm install node-gyp -g
npm install bcrypt -g
I've had the same or at least a similar error.
Running the following before trying to install bcrypt solved it for me:
npm install --global --production windows-build-tools
I also faced the same issue today whilst trying to install bcrypt on Windows 10 desktop. Turns out that bcrypt support stable versions of node better check out the docs
The solution for me was:
Upgrade node to a stable version: I manually downloaded and installed Windows installer from Node website.
Install the Windows build tools globally: npm install --global --production windows-build-tools
Finally npm install bcrypt --save
After this everything worked ok.
I also encountered this error.
I reinstall node-gyp using this command npm install node-gyp -g
after that I reinstall bccrypt using npm install bcrypt
And finally works
When working on the node API project.
Solution
rm -rf node_modules/bcrypt
npm install node-gyp -g
npm install bcrypt#[VERSION] -g
it's working for me on window 10.

Error installing sqlite3 in node.js

I have a problem installing package in node.js. My version of npm is 2.14.3 and I need to install sqlite3 package.
In my proyect path Im usign this command: "npm install sqlite3 --save" I have the next error:
npm WARN package.json node-sqlite#1.0.1 No description npm WARN
package.json node-sqlite#1.0.1 No repository field. npm WARN
package.json node-sqlite#1.0.1 No README data npm WARN package.json
node-sqlite#1.0.1 No license field. /
sqlite3#3.1.8 install /home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3
node-pre-gyp install --fallback-to-build node-pre-gyp ERR! Tried to download(403):
https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v46-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for sqlite3#3.1.8 and
node#4.1.0 (node-v46 ABI) (falling back to source compile with
node-gyp) make: Entering directory
'/home/pi/Desktop/node-sqlite_Sockets/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
Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:199451:1: fatal
error: opening dependency file
./Release/.deps/Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o.d.raw:
No such file or directory compilation terminated.
deps/sqlite3.target.mk:120: 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 1 make: Leaving directory
'/home/pi/Desktop/node-sqlite_Sockets/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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at
ChildProcess.emit (events.js:172:7) gyp ERR! stack at
Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.21-v7+ 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/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node"
"--module_name=node_sqlite3"
"--module_path=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm"
gyp ERR! cwd /home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3
gyp ERR! node -v v4.1.0 gyp ERR! node-gyp -v v3.0.3 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/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node
--module_name=node_sqlite3 --module_path=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm'
(1) node-pre-gyp ERR! stack at ChildProcess.
(/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:87:13) node-pre-gyp
ERR! stack at ChildProcess.emit (events.js:172:7) node-pre-gyp
ERR! stack at maybeClose (internal/child_process.js:817:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:211:5) node-pre-gyp ERR! System Linux
4.4.21-v7+ node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/node_modules/.bin/node-pre-gyp"
"install" "--fallback-to-build" node-pre-gyp ERR! cwd
/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3 node-pre-gyp
ERR! node -v v4.1.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.31
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/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node
--module_name=node_sqlite3 --module_path=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm'
(1) npm ERR! Linux 4.4.21-v7+ npm ERR! argv "/usr/local/bin/node"
"/usr/local/bin/npm" "install" "sqlite3" "--save" npm ERR! node v4.1.0
npm ERR! npm v2.14.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/pi/Desktop/node-sqlite_Sockets/npm-debug.log
If I try to execute my node.js program I have the next error:
module.js:338 throw err; ^ Error: Cannot find module
'/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node'
at Function.Module._resolveFilename (module.js:336:15) at
Function.Module._load (module.js:286:25) at Module.require
(module.js:365:17) at require (module.js:384:17) at Object.
(/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/sqlite3.js:4:15)
at Module._compile (module.js:434:26) at Object.Module._extensions..js
(module.js:452:10) at Module.load (module.js:355:32) at
Function.Module._load (module.js:310:12) at Module.require
(module.js:365:17)
After update (npm install -g npm)
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules/npm
npm WARN checkPermissions Missing write access to
/usr/local/lib/node_modules
/usr/local/lib
└── npm#3.10.9
npm ERR! Linux 4.4.21-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/ npm" "install"
"-g" "npm" npm ERR! node v4.1.0 npm ERR! npm v3.10.9 npm ERR! path
/usr/local/lib/node_modules/npm
npm ERR! code EACCES npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access
'/usr/local/lib/node_modules/npm' npm ERR! at Error (native) npm
ERR! { [Error: EACCES: permission denied, access
'/usr/local/lib/node_modules/npm'] npm ERR! errno: -13, npm ERR!
code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path:
'/usr/local/lib/node_modules/npm' } npm ERR! npm ERR! Please try
running this command again as root/Administrator. npm ERR! Please
include the following file with any support request: npm ERR!
/home/pi/Desktop/node-sqlite_Sockets/npm-debug.log
Somebody know how to solve it?
Thanks in advance!
Best regards.
have you installed sqlite3 before on another app? because your cached files could be corrupt. try to remove it from your cache with npm cache clean sqlite3 or clean your whole cache with npm cache clean and run the install script again.
Edit: after you edited your question. it seems to be a permission error. Try running the npm update with sudo npm install -g npm
Summary: It was a problem with an old npm version. The update to a newer version solved it by running sudo npm install -g npm.
This worked for me on Windows 10.
npm uninstall sqlite3
npm cache clean
npm install sqlite3
None of the answers in different stackoverflow threads worked for me.
I deleted the cache, deleted the lock file, installed another version of Node, updated NPM, etc., but none of them worked. Maybe my answer is off-topic, But if you just want to get the job done right now, you may be able to install the package you want with another tool like yarn:
yarn add <package>
is equivalent to
npm i --save <package>
For example, SQLite3 and Sequelize could not be installed on my computer with NPM, which I could install with Yarn.
This worked for me:
Previously app directory was /My Files/TestApp and it always threw that error.
According to a suggestion on https://github.com/mapbox/node-sqlite3/issues/1538, I moved the directory to another directory that doesn't have spaces in the path (/FolderNameWithoutSpaces/TestApp)
And it worked
macOS Monterey v12.1
node version: v17.3.1
npm version: v8.3.0
This may not be the exact answer to the above question, but for some people, it will work.
On linux you should check that you have python installed python --version, if not, you should check this https://stackoverflow.com/a/46245617/9477206
Edit on 2022 : Please check the supported version of Node in sqlite npm documentation and use the supported Node version (mostly by downgrading using nvm)
For me the node verion is v16.x whereas the Sqlite max supported version is v12.x, so I downgraded and the issues went off!
This worked for me:
First, I had Visual C++ 2013 installed, then configured globally by running
npm config set msvs_version 2013 --global
Then I ran an installation of node-gyp by running npm install node-gyp -g node-gyp
Finally, I installed Sqlite3 by running npm install sqlite3
Hope this helps someone as it had helped me

npm failing (gyp error and install script error) during npm install homebridge on debian

I am trying to install homebridge package on debian on my Dragonboard 410c using 'npm install -g homebridge'. However, I keep running into the following error pasted below. I have already installed nodejs-legacy.
Is there a solution to this problem, or is there an alternative way to download and install the package ánd its dependencies without npm?
npm WARN excluding symbolic link utils/ncov -> lib/ncov.js
\
curve25519#1.1.0 install /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/curve25519
node-gyp rebuild
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
make: Entering directory '/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/curve25519/build'
CXX(target) Release/obj.target/curve/node_curve.o
SOLINK_MODULE(target) Release/obj.target/curve.node
COPY Release/curve.node
make: Leaving directory '/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/curve25519/build'
npm WARN excluding symbolic link utils/ncov -> lib/ncov.js
bignum#0.11.0 install /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/srp/node_modules/bignum
node-gyp configure build
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
gyp: Undefined variable openssl_config_path in binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:344:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-linaro-lt-qcom
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/srp/node_modules/bignum
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
mdns#2.2.11 install /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/mdns
node-gyp rebuild
path.js:424
var path = (i >= 0) ? arguments[i] : process.cwd();
^
Error: ENOENT: no such file or directory, uv_cwd
at Error (native)
at Object.posix.resolve (path.js:424:50)
at Function.Module._resolveLookupPaths (module.js:249:17)
at Function.Module._resolveFilename (module.js:327:31)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object. (/usr/share/node-gyp/bin/node-gyp.js:13:11)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
npm ERR! bignum#0.11.0 install: node-gyp configure build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bignum#0.11.0 install script.
npm ERR! This is most likely a problem with the bignum package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls bignum
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 4.4.0-linaro-lt-qcom
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "homebridge"
npm ERR! cwd /home/linaro
npm ERR! node -v v4.2.2
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
ed25519#0.0.3 install /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/node_modules/ed25519
node-gyp rebuild
I'd recommend trying your commands from a different directory. I was trying to install a specific module in
/Users/my_username/.nvm/versions/node/v8.11.3/lib/node_modules/
and it was failing with a very similar error. I moved to
/Users/my_username/.nvm/versions/
(accidentally) ran npm install and it's working now.
I also discovered npm doctor in this process, which may help you get to the bottom of your problem.

npm install fails with gyp build error

I have been trying to get node and git working for a web project I am working on without any luck.
I have installed node from their website. When I try to do npm install on the git project I am working on it gives me the following error
C:\Users\Jibran\Desktop\ekhadim\ekhadimweb>npm install
npm http GET https://registry.npmjs.org/bcrypt
npm http 304 https://registry.npmjs.org/bcrypt
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
> bcrypt#0.7.8 install C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\node_modules\b
crypt
> node-gyp rebuild
C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\node_modules\bcrypt>node "C:\Program
Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\
node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform
.Targets(23,7): error MSB8007: The Platform for project 'bcrypt_lib.vcxproj' is
invalid. Platform='x64'. You may be seeing this message because you are tryin
g to build a project without a solution file, and have specified a non-default
Platform that doesn't exist for this project. [C:\Users\Jibran\Desktop\ekhadim\
ekhadimweb\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:807:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\node_modules\bcrypt
gyp ERR! node -v v0.10.28
gyp ERR! node-gyp -v v0.13.1
gyp ERR! not ok
npm ERR! bcrypt#0.7.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#0.7.8 install script.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! cwd C:\Users\Jibran\Desktop\ekhadim\ekhadimweb
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\Jibran\Desktop\ekhadim\ekhadimweb\npm-debug.log
npm ERR! not ok code 0
I have installed python, VC++ 2008 and 2010 and OpenSSL but nothing has worked for me yet.
Any help will be appreciated.
Thanks
Jibran
Installing windows build tools worked for me:
npm install --global --production windows-build-tools
Follow : https://github.com/nodejs/node-gyp#installation
Installing windows-build-tools didn't work for me. What did the trick was directly downloading and installing Python.

npm issue CERT_NOT_YET_VALID on raspberry pi

Can't get raspberry pi to npm install anything!
pi#raspberrypi ~/raspi-helloworld $ npm install serialport
npm WARN package.json raspi-helloworld#0.0.0 No README.md file found!
npm http GET http://registry.npmjs.org/serialport
npm http 304 http://registry.npmjs.org/serialport
npm http GET http://registry.npmjs.org/sf/0.1.6
npm http GET http://registry.npmjs.org/optimist
npm http GET http://registry.npmjs.org/nan
npm http GET http://registry.npmjs.org/node-pre-gyp
npm http GET http://registry.npmjs.org/bindings/1.1.1
npm http GET http://registry.npmjs.org/async/0.1.18
npm http 304 http://registry.npmjs.org/optimist
npm http 304 http://registry.npmjs.org/nan
npm http 304 http://registry.npmjs.org/async/0.1.18
npm http 304 http://registry.npmjs.org/sf/0.1.6
npm http 304 http://registry.npmjs.org/bindings/1.1.1
npm http 304 http://registry.npmjs.org/node-pre-gyp
npm http GET http://registry.npmjs.org/wordwrap
npm http 304 http://registry.npmjs.org/wordwrap
> serialport#1.4.0 install /home/pi/raspi-helloworld/node_modules/serialport
> node-pre-gyp install --fallback-to-build
node-pre-gyp http GET https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz
node-pre-gyp http CERT_NOT_YET_VALID (falling back to source compile with node-gyp)
make: Entering directory `/home/pi/raspi-helloworld/node_modules/serialport/build'
make: Warning: File `../binding.gyp' has modification time 7.1e+05 s in the future
ACTION Regenerating Makefile
gyp: binding.gyp not found (cwd: /home/pi/raspi-helloworld/node_modules/serialport/build) while trying to load binding.gyp
make: *** [Makefile] Error 1
make: Leaving directory `/home/pi/raspi-helloworld/node_modules/serialport/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/pi/projects/node-v0.10.2-linux-arm-pi/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:757:12)
gyp ERR! System Linux 3.6.11+
gyp ERR! command "/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/node" "/home/pi/projects/node-v0.10.2-linux-arm-pi/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--name=serialport" "--configuration=Release" "--module_name=serialport" "--version=1.4.0" "--major=1" "--minor=4" "--runtime=node" "--node_abi=v8-3.14" "--platform=linux" "--arch=arm" "--target_arch=arm" "--module_main=./serialport" "--host=https://node-serialport.s3.amazonaws.com/" "--module_path=/home/pi/raspi-helloworld/node_modules/serialport/build/serialport/v1.4.0/Release/v8-3.14-linux-arm" "--remote_path=./serialport/v1.4.0/Release/" "--package_name=v8-3.14-linux-arm.tar.gz" "--staged_tarball=build/stage/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz" "--hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/" "--hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz"
gyp ERR! cwd /home/pi/raspi-helloworld/node_modules/serialport
gyp ERR! node -v v0.10.2
gyp ERR! node-gyp -v v0.9.3
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/node rebuild --name=serialport --configuration=Release --module_name=serialport --version=1.4.0 --major=1 --minor=4 --runtime=node --node_abi=v8-3.14 --platform=linux --arch=arm --target_arch=arm --module_main=./serialport --host=https://node-serialport.s3.amazonaws.com/ --module_path=/home/pi/raspi-helloworld/node_modules/serialport/build/serialport/v1.4.0/Release/v8-3.14-linux-arm --remote_path=./serialport/v1.4.0/Release/ --package_name=v8-3.14-linux-arm.tar.gz --staged_tarball=build/stage/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz --hosted_path=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/ --hosted_tarball=https://node-serialport.s3.amazonaws.com/serialport/v1.4.0/Release/v8-3.14-linux-arm.tar.gz' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/raspi-helloworld/node_modules/serialport/node_modules/node-pre-gyp/lib/util/compile.js:76:29)
node-pre-gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:703:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:770:5)
node-pre-gyp ERR! System Linux 3.6.11+
node-pre-gyp ERR! command "node" "/home/pi/raspi-helloworld/node_modules/serialport/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/raspi-helloworld/node_modules/serialport
node-pre-gyp ERR! node -v v0.10.2
node-pre-gyp ERR! node-pre-gyp -v v0.5.11
node-pre-gyp ERR! not ok
npm ERR! serialport#1.4.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! `sh "-c" "node-pre-gyp install --fallback-to-build"` failed with 1
npm ERR!
npm ERR! Failed at the serialport#1.4.0 install script.
npm ERR! 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 their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.6.11+
npm ERR! command "/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/node" "/home/pi/projects/node-v0.10.2-linux-arm-pi/bin/npm" "install" "serialport"
npm ERR! cwd /home/pi/raspi-helloworld
npm ERR! node -v v0.10.2
npm ERR! npm -v 1.2.15
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/raspi-helloworld/npm-debug.log
npm ERR! not ok code 0
As the commenters have suggested, the first thing to check is that you have the correct system time -- or at least an incorrect time that falls within the range your certificate professes ;-)
The error code is nodejs error, not raspberry per se. It refers to invalid ssl certificate. This solution worked for me.
$ npm config set strict-ssl false
$ npm config set unsafe-perm true
$ npm config set registry http://registry.npmjs.org/
I had this error in Ubuntu WSL2 on Windows10.
A restart of my PC solved the issue.
Had this error👇
npm ERR! code CERT_NOT_YET_VALID
npm ERR! errno CERT_NOT_YET_VALID
npm ERR! request to https://registry.npmjs.org/helmet failed, reason: certificate is not yet valid
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Local\npm-cache_logs\2021-07-08T18_40_13_221Z-debug.log
Updating my system time worked.

Resources