Getting error in updating npm in Angular 6 based project - node.js

I wanted to update new version of npm 6.4.0 from npm 6.1.0 , using cli command
npm install -g npm
but I got error while updating
npm ERR! path /usr/local/lib/node_modules/npm/node_modules/ansi-regex
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/node_modules/ansi-regex'
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm/node_modules/ansi-regex'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules/npm/node_modules/ansi-regex\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules/npm/node_modules/ansi-regex' }
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/user/.npm/_logs/2018-08-23T06_53_24_306Z-debug.log

For ubuntu/linux you have to use below command :
sudo npm install -g npm

Related

how can i install lite-server? it keeps giving me error

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/lite-server
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/lite-server'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/lite-server'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/lite-server'
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/abdulfattahsheu/.npm/_logs/2022-03-22T14_26_56_457Z-debug-
above is the error it keeps giving me
Try this commands line
npm install -g npm-windows-upgrade
npm install -g concurrently
npm install lite-server#2.3 --save-dev

how installation Protractor on mac

I am trying installation for protractor but getting error
The operation was rejected by your operating system
admin$ npm install -g protractor
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/protractor
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/protractor'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/protractor'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/protractor'
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/admin/.npm/_logs/2022-03-05T00_08_05_266Z-debug-0.log
Try sudo
sudo npm install -g protractor

Can't update the node version using npm

I ran the command npm install -g n to then install the latest node version, but this came up:
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-11-12T19_56_01_886Z-debug.log
Do you know how can I fix it?

Upgrade expo cli to latest version. i got this error

I try upgrade expo cli to latest version. i got this error.
DALAs-MacBook-Pro:~ SEAR$ npm i -g expo-cli
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/expo-cli
npm ERR! dest /usr/local/lib/node_modules/.expo-cli-dKBr48UN
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/expo-cli',
npm ERR! dest: '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'
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/sear/.npm/_logs/2021-06-26T14_35_24_132Z-debug.log
Node : v13.14.0
NPM : 7.7.5
Current Expo : 3.18.0
Please help, Thank in advance.
it was fixed by running sudo npm i -g expo-cli.

Why is permission denied in terminal when I tried to install sass using node.js

Why can't I install? Help! I followed this tutorial and it told me to install node.js and I did.
karenchan:~ karenchan$ npm install -g sass
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/karenchan/.npm/_logs/2020-07-30T20_33_04_760Z-debug.log
karenchan:~ karenchan$ npm install -g sass
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/karenchan/.npm/_logs/2020-07-30T20_44_30_523Z-debug.log
karenchan:~ karenchan$
This is the problem:
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Two solutions:
Install globally as "root", using sudo
sudo npm install -g sass
Install locally (so "permissions" shouldn't be an issue):
cd <<my project>>
npm install sass
FYI, other options might include:
Edit your project's package.json
Install and use NVM
Here's a good tutorial on the latter:
Installing Node.js Tutorial: Using nvm, Tierney Cyren

Resources