Invalid syntax while installing bcrypt with npm on w10 x64 - node.js

I have python 2.7.15 and 3.7 installed on my machine.
I ran this command per
https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#microsoft-windows
npm install --global --production windows-build-tools
When I run npm install --save bcrypt, I get the following error:
PS C:\Users\Yael-PC1\Projectz\ys> npm install --save bcrypt
> bcrypt#3.0.7 install C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.7/bcrypt_lib-v3.0.7-node-v64-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt#3.0.7 and node#10.15.3 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Yael-PC1\AppData\Local\Programs\Python\Python37\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack at ChildProcess.emit (events.js:189:13)
gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Yael-PC1\\Projectz\\ys\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node"
"--module_name=bcrypt_lib" "--module_path=C:\\Users\\Yael-PC1\\Projectz\\ys\\node_modules\\bcrypt\\lib\\binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt\lib\binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\Yael-PC1\Projectz\ys\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:189:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:970:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Windows_NT 10.0.17763
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Yael-PC1\\Projectz\\ys\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt
node-pre-gyp ERR! node -v v10.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\Users\Yael-PC1\Projectz\ys\node_modules\bcrypt\lib\binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.7 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! C:\Users\Yael-PC1\AppData\Roaming\npm-cache\_logs\2019-12-14T02_49_00_828Z-debug.log
PS C:\Users\Yael-PC1\Projectz\ys> ^C
PS C:\Users\Yael-PC1\Projectz\ys>

Ah, this.
If you look at the lines at the end, it says NOT OK, when it looks at your node version and the node-pre-gyp version
The easiest solution to this should be to just upadate npm, node and node-pre-gyp
npm install npm#latest --save
npm install node#latest --save
npm install node-pre-gyp#latest --save
npm install prebuild#latest --save
npm install node-gyp#latest --save
npm install bcrypt --save
This should theoretically take care of the error you're getting.
HOWEVER
If this still persists, you can consider switching to bcryptjs, which will work with your code if you're just using the hash and compare functions, and also has no dependencies, so it is a safer bet.

Related

Error while installing canvas on Raspberry PI 4

I've tried installing node canvas multiple times on my Raspberry PI 4, and every time, no matter what permissions I give, no matter how many times I install node-pre-gyp, it will always result in this same error.
> canvas#2.6.1 install /home/pi/.djsbots/Starr/node_modules/canvas
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v72-linux-glibc-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for canvas#2.6.1 and node#12.16.3 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
gyp WARN EACCES current user ("pi") does not have permission to access the dev dir "/root/.cache/node-gyp/12.16.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/.djsbots/Starr/node_modules/canvas/.node-gyp"
Package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 4.19.97-v7l+
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=/home/pi/.djsbots/Starr/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/pi/.djsbots/Starr/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/pi/.djsbots/Starr/node_modules/canvas
gyp ERR! node -v v12.16.3
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/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/.djsbots/Starr/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/.djsbots/Starr/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/pi/.djsbots/Starr/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:310:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.19.97-v7l+
node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/.djsbots/Starr/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/.djsbots/Starr/node_modules/canvas
node-pre-gyp ERR! node -v v12.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
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=/home/pi/.djsbots/Starr/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/.djsbots/Starr/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN starr#1.5.2 No description
npm WARN starr#1.5.2 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas#2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas#2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-06-21T00_57_47_594Z-debug.log
Any help would be appreciated

npm install error: sqlite never downloads

When running npm install to download project dependencies, sqlite3 encounters an error and never installs. Trying npm install sqlite3 produces same error.
Running on Linux Beta (Debian v10 buster) on ChromeOS.
Installs fine on others' machines. Expect it has something to do with ChromeOS.
Link to project files: https://github.com/andrewbruner/fsjs-techdegree-unit-09
andrewbruner#penguin:~/treehouse/fsjs-techdegree-unit-09$ npm install
> sqlite3#4.0.6 install /home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.0.6/node-v72-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3#4.0.6 and node#12.16.3 (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21)
gyp ERR! System Linux 4.19.98-08076-g24ab33fb8e14
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3/lib/binding/node-v72-linux-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3
gyp ERR! node -v v12.16.3
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/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3/lib/binding/node-v72-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:310:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.19.98-08076-g24ab33fb8e14
node-pre-gyp ERR! command "/usr/bin/node" "/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
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/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/andrewbruner/treehouse/fsjs-techdegree-unit-09/node_modules/sqlite3/lib/binding/node-v72-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN techdegree-fullstackjs-rest-api#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3#4.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3#4.0.6 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/andrewbruner/.npm/_logs/2020-05-07T18_52_06_591Z-debug.log
npm can't download a prebuilt binary and thus falls back to building it with node-gyp. This is where the build fails.
Note the line in your log where it says: gyp ERR! stack Error: not found: make
It seems as if you don't have make installed. Since you're on Debian, you should be able to install make by running: sudo apt-get install build-essential.
This question has already been extensively discussed in the following question: npm failed to install time with make not found error
Make sure to take a close look at error messages :)

VCBuild.exe not found when attempting to install bcrypt, node-gyp and windows-build-tools installed

I'm trying to add bcrypt to my application, and am currently struggling with getting it to build when it is added as a package. I have tried several solutions, but am repeatedly getting this output when attempting to install bcrypt:
bcrypt#3.0.7 install C:\MAIC\MAIC-API\node_modules\bcrypt
node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.7/bcrypt_lib-v3.0.7-node-v64-win32-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt#3.0.7 and node#10.5.0 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framew
ork 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it i
s installed elsewhere. [C:\MAIC\MAIC-API\node_modules\bcrypt\build\binding.sln]
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\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\MAIC\\MAIC-API\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\\MAIC\\MAIC-API\\node_modules\\bcrypt\\lib\\binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd C:\MAIC\MAIC-API\node_modules\bcrypt
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\MAIC\MAIC-API\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\MAIC\MAIC-API\node_modules\bcrypt\lib\binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\MAIC\MAIC-API\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:961:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
node-pre-gyp ERR! System Windows_NT 10.0.18362
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\MAIC\\MAIC-API\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\MAIC\MAIC-API\node_modules\bcrypt
node-pre-gyp ERR! node -v v10.5.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\MAIC\MAIC-API\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\MAIC\MAIC-API\node_modules\bcrypt\lib\binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN maic-api#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.7 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.7 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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2020-02-01T19_21_21_049Z-debug.log
As mentioned in the title, I've attempted installing windows-build-tools for npm as well as Build tools for Visual Studio 2019 (which I already had installed). What might I be missing here?
Try the following things :
Uninstall any other previous installation for MSBuild tool if any other than below one.
Uninstall windows-build-tools
npm cache clean -f
Run below command with Admin right
npm install -g node-gyp
npm install --g --production windows-build-tools
Then try to install
npm install bcrypt

Firebase installation error with "Pre-built binaries not found for grpc#1.19.0 and node#12.1.0"

I am trying to install firebase on my MacBook, and is getting the following error.
$ npm install -g firebase
> grpc#1.19.0 install /Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.19.0/node-v72-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for grpc#1.19.0 and node#12.1.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "<string>", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:304:12)
gyp ERR! stack at ChildProcess.emit (events.js:196:13)
gyp ERR! stack at maybeClose (internal/child_process.js:1000:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/Users/satoshi/.nvm/versions/node/v12.1.0/bin/node" "/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/satoshi/.nvm/versions/node/v12.1.0/bin/node /Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:196:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1000:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
node-pre-gyp ERR! System Darwin 18.5.0
node-pre-gyp ERR! command "/Users/satoshi/.nvm/versions/node/v12.1.0/bin/node" "/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc
node-pre-gyp ERR! node -v v12.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
Failed to execute '/Users/satoshi/.nvm/versions/node/v12.1.0/bin/node /Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/satoshi/.nvm/versions/node/v12.1.0/lib/node_modules/firebase/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc#1.19.0 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc#1.19.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/satoshi/.npm/_logs/2019-04-30T20_15_40_148Z-debug.log
I have npm (6.9.0) and node (12.1.0). It looks like a type of version mismatch, but I am not able to find out how to fix this issue.
The problem here is that grpc 1.19.0 is not compatible with Node 12. Version 1.20.2 of grpc is compatible with Node 12, so if Firebase updates their dependency that will also fix the problem.
This work for me:
install nvm from https://github.com/nvm-sh/nvm
switch to node version : v10.15.3

npm install fails on ubuntu 18.04 with error : "Failed at the bcrypt#3.0.3 install script"

I get below error while setting up a nodejs project on Ubuntu 18.04. The npm version installed is 6.x and the node version installed is 10.x.
I searched for the fixes here and here on SO but did not get any appropriate fix.
bcrypt#3.0.3 install /home/ubuntu/reko_dev/web/backend/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v3.0.3/bcrypt_lib-v3.0.3-node-v64-linux-x64-glibc.tar.gz
node-pre-gyp WARN Pre-built binaries not found for bcrypt#3.0.3 and node#10.15.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/usr/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Linux 4.15.0-1021-aws
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/lib/binding" "--napi_version=3" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /home/ubuntu/reko_dev/web/backend/node_modules/bcrypt
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:962:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Linux 4.15.0-1021-aws
node-pre-gyp ERR! command "/usr/bin/node" "/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ubuntu/reko_dev/web/backend/node_modules/bcrypt
node-pre-gyp ERR! node -v v10.15.0
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
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/ubuntu/reko_dev/web/backend/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ubuntu/reko_dev/web/backend/node_modules/bcrypt/lib/binding --napi_version=3 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN mongoose-auto-increment#5.0.1 requires a peer of mongoose#^4.1.12 but none is installed. You must install peer dependencies yourself.
npm WARN rekogapiserver#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.3 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/ubuntu/.npm/_logs/2019-01-08T17_09_19_086Z-debug.log
As #tkausl mentioned, looks like make isn’t installed.
sudo apt-get update
sudo apt-get install build-essential

Resources