firebase-tools fails to load via terminal install on macOS - node.js

Trying to install firebase-tool for CLI. Getting failures.
running on macOS
I have seen suggestions like the following ...
Troubling with installing firebase-tools
I tried $ sudo npm install -g firebase-tools
Using 'sudo' gets past the error issues trying to access directories. but still crashes
The troubling bit seems to be this
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.4.1/node-v57-darwin-x64.tar.gz
I can put the above URL in a browser and it will download the tar.
I also have access problem even if I use 'sudo'
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/build'
Trying to understand how to get past the errors to install firebase-tools, Also some suggestions say to install node via nvm. Found tutorial on nvm, anyone know what doing this install will to to projects I already have on my machine. e.g confusion finding correct node.js, or need to reinstall everything that I already installed using my current node install?
The full error messages are ...
sudo npm install -g firebase-tools
Password:
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase- tools/bin/firebase
> grpc#1.4.1 install /usr/local/lib/node_modules/firebase- tools/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.4.1/node- v57-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc#1.4.1 and node#8.9.4 (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/firebase-tools/node_modules/grpc/build'
gyp ERR! System Darwin 17.3.0
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" "--library=static_library" "-- module=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary/grpc_node.node" "-- module_name=grpc_node" "--module_path=/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/src/node/extension_binary"
gyp ERR! cwd /usr/local/lib/node_modules/firebase-tools/node_modules/grpc
gyp ERR! node -v v8.9.4
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 --library=static_library -- module=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary/grpc_node.node -- module_name=grpc_node --module_path=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/node_modules/node- pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 17.3.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback- to-build" "--library=static_library"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/firebase- tools/node_modules/grpc
node-pre-gyp ERR! node -v v8.9.4
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 --library=static_library -- module=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary/grpc_node.node -- module_name=grpc_node --module_path=/usr/local/lib/node_modules/firebase- tools/node_modules/grpc/src/node/extension_binary' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: grpc#1.4.1 (node_modules/firebase-tools/node_modules/grpc):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: grpc#1.4.1 install: `node- pre-gyp install --fallback-to-build --library=static_library`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ firebase-tools#3.17.4
added 8 packages and updated 1 package in 37.194s
I also tried to cd in to the node_modules directory and run the install from there as proposed in this post
firebase-tools cannot install, why?
The result is pages and pages of warning messages and finally an error
npm ERR! path /usr/local/lib/node_modules/firebase-tools/bin/firebase
npm ERR! code ELOOP
npm ERR! errno -62
npm ERR! syscall chmod
npm ERR! ELOOP: too many symbolic links encountered, chmod '/usr/local/lib/node_modules/firebase-tools/bin/firebase'

npm install -g firebase-tools
works on windows without causing any error. but when it comes to Mac you need to start it with sudo.
so the command will be:
sudo npm install -g firebase-tools
then check the version using firebase -V on terminal to make sure you've done correctly.

I encountered the same problem what I did was made sure I was in root directory and the ran :
sudo npm i g firebase-tools
Or in Windows
npm i g firebase-tools
I was constantly doing it in my project folder and kept getting the same error.

I had the same problem on macOS High Sierra. The only thing that worked for me in the end was to uninstall node.js from Homebrew (brew uninstall node), then install node.js using the downloadable installer (https://nodejs.org/en/download/) then install the Firebase CLI using sudo:
sudo npm install -g firebase-tools
After that, I still received the warnings, but could launch and configure Firebase. Not an ideal solution, but it is serving as a fix for me at the moment.

sudo npm install -g firebase-tools
sudo worked for me!
Without sudo I was getting the following error:
Lewis-MacBook-Pro:demo-firebase-func leg$ npm install -g firebase-tools
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
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 ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/leg/.npm/_logs/2018-10-03T20_35_51_209Z-debug.log

Installing Node from the package on its website, rather than through Brew, solved this issue for me.

In my case I had a corrupted Firebase install, solved by running:
curl -sL firebase.tools | upgrade=true bash
If you don't have Firebase already you can just run:
curl -sL firebase.tools
Reference: https://firebase.google.com/docs/cli#mac-linux-auto-script

Related

I want to install mechanic on npm, I tried to run this line sudo npm install -g mechanic, but it gives me error, I don't understand this error

I want to install mechanic on my nginx server.
I got this error when I execute sudo npm install -g mechanic:
tigaron#galaxybrainpower:/var/www/tigaron$ sudo npm install -g mechanic
/usr/bin/mechanic -> /usr/lib/node_modules/mechanic/bin/mechanic
> fs-ext#2.0.0 install /usr/lib/node_modules/mechanic/node_modules/fs-ext
> node-gyp configure build
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/home/tigaron/.cache/node-gyp/10.20.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/mechanic/node_modules/fs-ext/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/mechanic/node_modules/fs-ext/.node-gyp'
gyp ERR! System Linux 4.15.0
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /usr/lib/node_modules/mechanic/node_modules/fs-ext
gyp ERR! node -v v10.20.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fs-ext#2.0.0 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fs-ext#2.0.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! /home/tigaron/.npm/_logs/2020-05-24T06_29_26_857Z-debug.log
What is happening here? How to fix this error and proceed with the installation?
This answer solved the same issue I had when installing a different package.
Apparently the nobody user is used when building packages globally, but the directories are owned by root so it fails permissions. Configuring npm to use root with the following command is what the answer recommends.
npm -g config set user root

Vue CLI install issues

i'm learning Vue.JS and i need to install Vue CLI.
NodeJS : v13.8.0
Vue CLI : v4.2.2
I installed NodeJS without problems but when i go to my folder on terminal and install Vue CLI with (npm install -g #vue/cli) i got a lot of errors.
MacBook-Pro-de-Cedric:excli cedric$ npm install -g #vue/cli
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue/cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue/cli/node_modules
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/#vue
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules/#vue/cli
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#vue/cli'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#vue/cli'] {
npm ERR! stack: "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#vue/cli'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/#vue/cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cedric/.npm/_logs/2020-02-09T15_09_00_595Z-debug.log
I can create a project via terminal with: (vue create nameofproject) but it also contains error and i can't lauch npm run serve
gyp: No Xcode or CLT version detected!
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:321:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/cedric/Documents/Projets Site Web : Apps/VueJs/excli/projet/node_modules/fsevents
gyp ERR! node -v v13.8.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
Successfully created project projet.
Get started with the following commands:
$ cd projet
$ npm run serve
MacBook-Pro-de-Cedric:excli cedric$ npm run serve
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/cedric/Documents/Projets Site Web : Apps/VueJs/excli/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/cedric/Documents/Projets Site Web : Apps/VueJs/excli/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cedric/.npm/_logs/2020-02-09T15_18_01_082Z-debug.log
If someone know how i can fix that it would be veryyy nice.
Thanks
If you are on mac then try sudo npm install -g #vue/cli instead of npm install -g #vue/cli for the global installation.
It's since the path of Node module has been missed, you can just type sudo npm install -g #vue/cli to install Vue, which means install vue under the global environment, either you can re-set your node module path.
You have to execute npm install -g with superuser right (with sudo for exemple on linux) because it seems like your npm's directory is under superuser right.
You can also change the npm's default directory

How to fix this error "gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/mohamedessam/Desktop/NodeJs/node_modules/bcrypt/build'"

I am trying to install bcrypt on Ububtu 18.04. I am using this command for installation:
sudo npm i --save bcrypt
and I am getting an error.
This is the reported error:
> bcrypt#3.0.6 install /home/mohamedessam/Desktop/NodeJs/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 Pre-built binaries not installable for bcrypt#3.0.6 and
node#8.10.0 (node-v57 ABI, glibc) (falling back to source compile with
node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/home
/mohamedessam/Desktop/NodeJs/node_modules/bcrypt/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/mohamedessam
/Desktop/NodeJs/node_modules/bcrypt/build'
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules
/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-
build" "--module=/home/mohamedessam/Desktop/NodeJs/node_modules/bcrypt
/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--
module_path=/home/mohamedessam/Desktop/NodeJs/node_modules/bcrypt
/lib/binding" "--napi_version=1" "--node_abi_napi=napi" "--
napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /home/mohamedessam/Desktop/NodeJs/node_modules/bcrypt
gyp ERR! node -v v8.10.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/local
/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure
--fallback-to-build --module=/home/mohamedessam/Desktop/NodeJs
/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib
--module_path=/home/mohamedessam/Desktop/NodeJs/node_modules/bcrypt
/lib/binding --napi_version=1 --node_abi_napi=napi --napi_build_version=0
--node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home
/mohamedessam/Desktop/NodeJs/node_modules/node-pre-gyp/lib
/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose
(internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit
(internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.15.0-54-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/mohamedessam/Desktop
/NodeJs/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/mohamedessam/Desktop/NodeJs/node_modules
/bcrypt
node-pre-gyp ERR! node -v v8.10.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/local/lib/node_modules
/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build
--module=/home/mohamedessam/Desktop/NodeJs/node_modules/bcrypt/lib/binding
/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/mohamedessam
/Desktop/NodeJs/node_modules/bcrypt/lib/binding --napi_version=1
--node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57'
(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":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.6 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.6 install script.
npm ERR! This is probably not a problem with npm. It is likely
additional logging output above.
It seems that npm doesn't have permission to install bcrypt.
After serching online I also tried this command:
sudo chown -R $(whoami) /home/mohamedessam/Desktop/NodeJs/node_modules/,
sudo npm i --unsafe-perm
but it gives me the same error. What should I do in oredr to install it successfully?
Resolving EACCES permissions errors when installing packages globally
If you see an EACCES error when you try to install a package globally, you can either:
Reinstall npm with a node version manager (recommended),
or
Manually change npm’s default directory
Reinstall npm with a node version manager§
This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in “Downloading and installing Node.js and npm”. You do not need to remove your current version of npm or Node.js before installing a node version manager.
Manually change npm’s default directory§
Note: This section does not apply to Microsoft Windows.
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, you will create and use hidden directory in your home directory.
Back up your computer.
On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
source ~/.profile
To test your new configuration, install a package globally without using sudo:
npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don’t want to modify ~/.profile):
NPM_CONFIG_PREFIX=~/.npm-global
I gave 777 permission to the files with this command:-
chmod -R 777 ./
and worked for me then.

Installing Angular on Mac OS 10.13

I'm trying to follow the quickstart on running Angular locally (on MacOS 10.13.6). With the first command, I already get some errors:
npm install -g #angular/cli
Output:
npm ERR! path /usr/local/lib/node_modules/#angular/cli/node_modules/socks
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#angular/cli/node_modules/socks'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/#angular/cli/node_modules/socks']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/#angular/cli/node_modules/socks\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path:
npm ERR! '/usr/local/lib/node_modules/#angular/cli/node_modules/socks' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx/.npm/_logs/2019-03-12T23_55_12_063Z-debug.log
Running with sudo gives me the following:
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/#angular/cli/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 17.7.0
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/#angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/#angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64" "--napi_version=3" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/#angular/cli/node_modules/fsevents
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 '/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/#angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/#angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/#angular/cli/node_modules/fsevents/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 Darwin 17.7.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/#angular/cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/#angular/cli/node_modules/fsevents
node-pre-gyp ERR! node -v v10.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
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/#angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/#angular/cli/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64 --napi_version=3 --node_abi_napi=napi' (1)
My node version is LTS (10.15.3). Any idea what's causing this and how to get angular to run on Mac?
you will need the write permission in node_modules directory:
sudo chown -R $(whoami) ~/.npm
Running sudo when installing npm will give you problems in the long run, so just run the command above.
npm throws error without sudo
sudo npm install -g #angular/cli
run with sudo permission and you should be good.
the /usr/local folder needs root permission, please try install it with sudo :
sudo npm install -g #angular/cli
As mentioned in the comments, using sudo isn't good practice, I had to run the following 3 commands to gain ownership of the relevant directories:
sudo chown -R $(whoami) ~/.npm
sudo chown -R $(whoami) /usr/local/lib/node_modules
sudo chown -R $(whoami) /usr/local/bin
Now I can install Angular CLI (or any other node packages) globally, without the need for sudo.

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

Resources