live-server won't be installed globally on Mac BigSur - node.js

My fresh new Mac Air won't install live-server globally. It keeps throwing the same error after I factory reseted my Mac though.
npm ERR! errno -13
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! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
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.
I tried re-install again on root but it throws this error
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/var/root/Library/Caches/node-gyp/14.17.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/live-server/node_modules/fsevents/.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/local/lib/node_modules/live-server/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 20.5.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 /usr/local/lib/node_modules/live-server/node_modules/fsevents
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
+ live-server#1.2.1
How do I actually install live-server on my Mac globally?

It looks like the error is caused because the script doesn't have the permissions to access /var.
Have you tried installing with sudo?
sudo npm install -g live-server

Related

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

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.

How to install npm lame raspberry pi 0

I'm trying to install npm lame on a raspberry pi 0. I've googled everything but keep getting this error:
Not really sure what else to do.
pi#raspberrypi:~/twotone $ sudo npm install lame
> lame#1.2.4 install /home/pi/twotone/node_modules/lame
> node-gyp rebuild
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/10.15.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/home/pi/twotone/node_modules/lame/.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 '/home/pi/twotone/node_modules/lame/.node-gyp'
gyp ERR! System Linux 4.14.79+
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 /home/pi/twotone/node_modules/lame
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN twotone#1.0.0 No description
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lame#1.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lame#1.2.4 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/2019-01-06T22_12_04_380Z-debug.log
You might have to add --unsafe-perm to the npm install command

running problems when trying to install hdf5 package using npm

hdf5#0.3.3 install /usr/local/lib/node_modules/hdf5
node-gyp rebuild --jobs max
gyp ERR! configure error gyp ERR! stack Error: EACCES: permission
denied, mkdir '/usr/local/lib/node_modules/hdf5/build' 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"
"rebuild" "--jobs" "max" gyp ERR! cwd /usr/local/lib/node_modules/hdf5
gyp ERR! node -v v8.11.3 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! hdf5#0.3.3 install:
node-gyp rebuild --jobs max npm ERR! Exit status 1 npm ERR! npm ERR!
Failed at the hdf5#0.3.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!
/Users/abc/.npm/_logs/2018-07-20T21_24_19_576Z-debug.log
Your error clearly says: Error: EACCES: permission denied, mkdir which is a permissions issue. Looks likes it trying to create directory called build inside /usr/local/lib/node_modules/hdf5/.
To fix it, just run the same command with sudo at the beginning.
But, I would not recommend it unless you install global package.
Do you try to install a local package ? if so, make sure the permissions of the node_modules is not root. If it does, either chown it or remove it and do npm install with non-root user.

Meteor Error: EACCES: permission denied, rmdir 'build'

I have this error when i try to update my meteor project from Meteor 1.3.5.1 to METEOR 1.4. I don't know why i have this error. I have already try to do a chown to .meteor and .np floder.
=> Errors while initializing project:
While loading package npm-bcrypt#0.8.7:
error: Command failed:
/home/noob/.meteor/packages/meteor-tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm
rebuild --no-bin-links --update-binary
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! stack at Error (native)
gyp ERR! System Linux 3.16.0-38-generic
gyp ERR! command
"/home/noob/.meteor/packages/meteor-tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/home/noob/.meteor/packages/meteor-tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
"rebuild"
gyp ERR! cwd
/home/noob/.meteor/packages/npm-bcrypt/.0.8.7.1np1i1l++os.linux.x86_64+web.browser+web.cordova/npm/node_modules/.temp-140iag7/node_modules/bcrypt
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 3.16.0-38-generic
npm ERR! argv
"/home/noob/.meteor/packages/meteor-tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/home/noob/.meteor/packages/meteor-tool/.1.4.0.hylsrj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm"
"rebuild" "--no-bin-links" "--update-binary"
npm ERR! node v4.4.7
npm ERR! npm v3.10.5
npm ERR! code ELIFECYCLE
npm ERR! bcrypt#0.8.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
.....
It was an permission error
I do a sudo chown -R $USERNAME /home/noob and now all work fine
Look more like a Node-gyp problem.
Extracted from Meteor docs:
If you have binary npm packages in your application node_modules
directory, you should run meteor npm rebuild (after meteor update) in
your application directory to recompile those packages.
If it still doesn't work, try removing your ~/.node-gyp file and then npm update.
Had to delete bcrypt directory
rm -r $HOME/.meteor/packages/npm-bcrypt/.0.7.8_2.f294j7++os.osx.x86_64+web.browser+web.cordova/npm/node_modules/bcrypt

Resources