How to "npm install" bcrypt on Windows 7 - node.js

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.

Related

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

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

Error with npm install opencv

When running "npm install opencv" this is what I get
> if not defined npm_config_node_gyp (node "C:\Users\Shaun\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\Shaun\node_modules\opencv\bui
ld\opencv\v4.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\Users\Shaun\node_module
s\opencv\build\opencv\v4.0.0\Release\node-v46-win32-ia32 --python=python2.7 --msvs_version=2015 ) else (node configu
re --fallback-to-build --module=C:\Users\Shaun\node_modules\opencv\build\opencv\v4.0.0\Release\node-v46-win32-ia32\ope
ncv.node --module_name=opencv --module_path=C:\Users\Shaun\node_modules\opencv\build\opencv\v4.0.0\Release\node-v46-wi
n32-ia32 --python=python2.7 --msvs_version=2015 )
Shaun#SHAUN-PC C:\Users\Shaun\node_modules\opencv
> if not defined npm_config_node_gyp (node "C:\Users\Shaun\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\.
.\node_modules\node-gyp\bin\node-gyp.js" build --fallback-to-build --module=C:\Users\Shaun\node_modules\opencv\build\o
pencv\v4.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\Users\Shaun\node_modules\op
encv\build\opencv\v4.0.0\Release\node-v46-win32-ia32 ) else (node build --fallback-to-build --module=C:\Users\Shaun\
node_modules\opencv\build\opencv\v4.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\
Users\Shaun\node_modules\opencv\build\opencv\v4.0.0\Release\node-v46-win32-ia32 )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Users\Shaun\node_modules\opencv\build\opencv.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.
Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists
on disk.
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:\Users\Shaun\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\l
ib\build.js:276: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 Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Shaun\\AppData\\Roaming\\npm\\node_modules\\n
pm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\Shaun\\node_modules\\
opencv\\build\\opencv\\v4.0.0\\Release\\node-v46-win32-ia32\\opencv.node" "--module_name=opencv" "--module_path=C:\\Us
ers\\Shaun\\node_modules\\opencv\\build\\opencv\\v4.0.0\\Release\\node-v46-win32-ia32"
gyp ERR! cwd C:\Users\Shaun\node_modules\opencv
gyp ERR! node -v v4.2.4
gyp ERR! node-gyp -v v3.2.1
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\Shaun\node_
modules\opencv\build\opencv\v4.0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\Users
\Shaun\node_modules\opencv\build\opencv\v4.0.0\Release\node-v46-win32-ia32' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\Shaun\node_modules\opencv\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:818:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Shaun\\node_modules\\opencv\\node_mo
dules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Shaun\node_modules\opencv
node-pre-gyp ERR! node -v v4.2.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.17
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd build --fallback-to-build --module=C:\Users\Shaun\node_modules\opencv\build\opencv\v4.
0.0\Release\node-v46-win32-ia32\opencv.node --module_name=opencv --module_path=C:\Users\Shaun\node_modules\opencv\buil
d\opencv\v4.0.0\Release\node-v46-win32-ia32' (1)
npm WARN optional Skipping failed optional dependency /node-inspector/biased-opener/x-default-browser/default-browser-
id:
npm WARN notsup Not compatible with your operating system or architecture: default-browser-id#1.0.2
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Shaun\package.json'
npm WARN Shaun No description
npm WARN Shaun No repository field.
npm WARN Shaun No README data
npm WARN Shaun No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\Shaun\\AppData\\Roaming\\npm\\node_modules\\npm\
\bin\\npm-cli.js" "install" "opencv"
npm ERR! node v4.2.4
npm ERR! npm v3.5.3
npm ERR! code ELIFECYCLE
npm ERR! opencv#4.0.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv#4.0.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 opencv 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 opencv
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls opencv
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Shaun\npm-debug.log
I've been trying bit by bit to work through each error and I seriously just cannot figure out what's wrong here.
I'm using OpenCV as part of a College project to use in a web app. It anyone can help me with this please do.
Thank you.
I had the same issue. I solved it by using OpenCV 2.4
It looks like your system is using OpenCV4, you should make sure you install openCV2 using the instructions in this repo, then install the latest peterbraden version of the package from GitHub with npm install peterbraden/node-opencv

Issue when installing sqlite3 in node.js

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!

Resources