firebase-tools install throws 'root does not have permission' error repeatedly

Focus On Content  ~/ click me to toggle the navigation bar to the right

During installtion of firebase-tools, you see a repeated output about ‘root does not have permission’ error. This is one way to fix that issue.

sudo npm install -g firebase-tools

Error/Warning

gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.9.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp"

Here is what I did to avoid this:

sudo mkdir -p /usr/local/lib/node_modules/firebase-tools/node_modules/grpc/.node-gyp/8.9.1/

This creates an empty directory with the path specified then rerun the following:

$ sudo npm install -g firebase-tools
Password: ###YOUR_PASSWORD_HERE###
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/bin/firebase
+ [email protected]
updated 1 package in 11.755s

I hope this helps.

Cheers.

If you find this article useful, consider signing up for my email or repost this on your favorite social site. See links on the right navigation.

Now for Today’s Inspiration

No work is stressful. It is your inability to manage your body, mind, and emotions that makes it stressful.