npm install Permission denied /.npm/_cacache/ - node.js

When I use sudo npm install command get error.
usr6783#usr6783:~/albarakaMobil/client/mobile-branch$ sudo npm install
[sudo] password for usr6783:
npm WARN deprecated react-native-languages#1.0.7: This project has been renamed to react-native-localize. Install using react-native-localize instead.
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm WARN deprecated sw-precache#5.2.1: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated circular-json#0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated sw-toolbox#3.6.0: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated core-js#1.2.7: core-js#<2.6.5 is no longer maintained. Please, upgrade to core-js#3 or at least to actual version of core-js#2.
npm WARN deprecated browserslist#1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated node-uuid#1.3.3: Use uuid module instead
npm WARN deprecated flatten#1.0.2: I wrote this module a very long time ago; you should use something else.
npm WARN deprecated socks#1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm ERR! code 1
npm ERR! Command failed: git clone --mirror -q git://github.com/rhdeck/react-native-fix-xcode-10.git /home/usr6783/.npm/_cacache/tmp/git-clone-aa7d6ae5/.git
npm ERR! /home/usr6783/.npm/_cacache/tmp/git-clone-aa7d6ae5/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/usr6783/.npm/_logs/2019-05-07T06_12_46_865Z-debug.log

use :
sudo npm cache clean -f
referred to this

I encountered a similar problem today, and npm suggested I should run
sudo chown -R 501:20 "~/.npm"
It says this is due to a bug in previous versions of npm and has since been addressed. You might want to update to npm version 7.10.0 or later, and run the command above.

Related

Mac: Expo being updated but not working and resolving out-of-date packages

I have the expo-cli working fine on Windows with a project initialized and running which I'd like to be able to do on this machine. However, on Mac, it keeps saying that the package is getting updated but when I try running expo init or the expo command globally it doesn't work:
/Users/daggerpov/.npm/bin/expo -> /Users/daggerpov/.npm/lib/node_modules/expo-cli/bin/expo.js
/Users/daggerpov/.npm/bin/expo-cli -> /Users/daggerpov/.npm/lib/node_modules/expo-cli/bin/expo.js
+ expo-cli#4.11.0
updated 2 packages in 94.007s
daggerpov#Daniels-MBP ~ % expo
zsh: command not found: expo
Also, I get a bunch of deprecation warnings but I've heard it's expected by installing this through npm, nevertheless here's the full output:
daggerpov#Daniels-MBP ~ % npm install -g expo-cli
npm WARN deprecated graphql-tools#3.0.0: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as #graphql-tools/schema, #graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated uuid#3.0.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
/Users/daggerpov/.npm/bin/expo -> /Users/daggerpov/.npm/lib/node_modules/expo-cli/bin/expo.js
/Users/daggerpov/.npm/bin/expo-cli -> /Users/daggerpov/.npm/lib/node_modules/expo-cli/bin/expo.js
+ expo-cli#4.11.0
updated 2 packages in 94.007s
What I've done to try resolving the issue of not being able to use the expo command has been:
installing Watchman through homebrew (it had no errors and came out fine)
running cd ~/node_modules && npm i expo-cli && sudo npm i -g expo && sudo npm i --global expo-cli
I followed this YouTube tutorial which said to run npm install expo-cli global which resulted in this:
daggerpov#Daniels-MBP ~ % npm install expo-cli global
(just some of the same deprecation warnings)
npm WARN checkPermissions Missing write access to /Users/daggerpov/node_modules/expo-cli
npm WARN daggerpov#1.0.0 No description
npm WARN daggerpov#1.0.0 No repository field.
npm ERR! code ELOOP
npm ERR! syscall access
npm ERR! path /Users/daggerpov/node_modules/expo-cli
npm ERR! errno -62
npm ERR! ELOOP: too many symbolic links encountered, access '/Users/daggerpov/node_modules/expo-cli'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/daggerpov/.npm/_logs/2021-09-10T06_57_31_944Z-debug.log
Perhaps since my node version is a little more recent than the LTS it could pose a problem?
daggerpov#Daniels-MBP ~ % node --version
v14.8.0
daggerpov#Daniels-MBP ~ % npm --version
6.14.8
UPDATE: I've changed my node version to the LTS and have made sure that usr/local/bin is in $PATH but this did not fix the issue.
daggerpov#Daniels-MBP ~ % echo $PATH
/Users/daggerpov/.pyenv/shims:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
daggerpov#Daniels-MBP ~ % node --version
v14.17.6
I've installed nvm by following what was outlined in this issue: then I ran nvm install node and it gave me v16.9.0. Then, I ran npm install --global expo-cli as I did before and the expo command now runs fine.
Important note:
The expo command would only work right after using the nvm install node command so when I went to VSC I had to use that before every session. I will try to find a solution to this issue and edit this answer accordingly. So, this is how you configure your node version using nvm and have it stay. Personally, I did nvm use 16.9.0 then when I checked my node version it saved.

Error when running "npm install -g #vue/cli", reinstall attempted many times

I have been stuck on this for a long time. When i run npm install -g #vue/cli, it pops up the following error. simliar error occurs also when I run vue create project-name. I have tried reinstall many times and I have tried clean the cache as well. I am clear that the dictionary in the error " C:\Users\zhang\node_modules.bin/../node/bin/node" does not exist, but i have no idea how to fix it.
C:\Users\zhang>npm install -g #vue/cli
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm ERR! code 127
npm ERR! path C:\Users\zhang\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\core-js-pure
npm ERR! command failed
npm ERR! command D:\Program Files\git\bin\bash.exe -c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! /c/Users/zhang/node_modules/.bin/node: line 8: C:\Users\zhang\node_modules\.bin/../node/bin/node: No such file or directory
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\zhang\AppData\Local\npm-cache\_logs\2021-05-02T21_16_30_121Z-debug.log
I have been stuck on this for hours and I appreciate any help from you
Thank you !
The WARNs is not an issue.
It did fail to run node binaries.
npm ERR! /c/Users/zhang/node_modules/.bin/node: line 8: C:\Users\zhang\node_modules\.bin/../node/bin/node: No such file or directory
Make sure you get the right path. Or change the env PATH variable accordingly.
please follow any of these to avoid these
1.sett the Environment path correctly
2.make sure that current user has the permission to process the data
ls -la /usr/lib/node_modules
whoami
sudo chown -R $USER /usr/lib/node_modules(setting the permission to current user)
3.Install the npm as sudo user by
sudo npm i -g #vue/cli

npm install errors with angular project downloaded from github

Bear with me. This is my first time posting a question.
What I did: cloned repo went into main folder and used npm install.
npm WARN deprecated #angular/http#5.2.11: Package no longer supported. Use #angular/common
instead, see https://angular.io/guide/deprecations#angularhttp
npm WARN deprecated angularfire2#5.4.2: AngularFire has moved, we're now #angular/fire
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 deprecated angular-sortablejs#2.7.0: angular-sortablejs was renamed to ngx-sortablejs, please use the latter one, only ngx-sortablejs will be updated in the future
npm WARN deprecated extract-text-webpack-plugin#3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated bfj-node4#5.3.1: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #google-cloud/functions-emulator#1.0.0-beta.6: Deprecating in favor of
the Functions Framework and firebase-tools. See https://github.com/googlearchive/cloud-functions-emulator/issues/327
npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist
>3.0 config used in other tools.
npm WARN deprecated request#2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated hawk#3.1.3: This module moved to #hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated json3#3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated boom#2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated cryptiles#2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated sntp#1.0.9: This module moved to #hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated hoek#2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
node-pre-gyp ERR! cwd C:\Users\genod\programing\tonysProjects\TAHelper\node_modules\grpc
node-pre-gyp ERR! node -v v12.16.1
node-pre-gyp ERR! node-pre-gyp -v v0.12.0
node-pre-gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc#1.20.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.20.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Angular and NPM issue

I'm currently learning angular 9 so when i tried to install node js and npm with latest version that is node version 12.* and npm version 6.14.*. I'm facing problem whith ng new and npm install command
Issues are as follows:
sudo npm install
npm WARN deprecated mkdirp#0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Unexpected end of JSON input while parsing near '...ure":"-----BEGIN PGP '
npm ERR! A complete log of this run can be found in:
npm ERR! /home/frustrated_coder/.npm/_logs/2020-03-29T14_31_40_275Z-debug.log
ng new angular-test
Installing packages...npm WARN deprecated mkdirp#0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Unexpected end of JSON input while parsing near '...200772","tarball":"ht'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/frustrated_coder/.npm/_logs/2020-03-29T14_20_56_952Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.
Also i working on angular-electron but the majority of the problem is with that as well due to npm install command in it.
This is the https://github.com/maximegris/angular-electron url from where i'm cloning angular electron.
Use Windows Powershell as an administrator and run;
npm cache clean --force
npm install -g #angular/cli

How to suppress deprecation warning from npm/nvm in zsh?

I am using nvm for managing node versions. I have installed it as a plugin to zsh via zsh-nvm. I have installed two versions of node - v6.1.0 and v.0.10.42. Since I am working on a project, which uses the latter one, I have set it at the default one. Now, every time I open a terminal window, I get these warnings:
npm WARN deprecated This version of npm lacks support for important features,
npm WARN deprecated such as scoped packages, offered by the primary npm
npm WARN deprecated registry. Consider upgrading to at least npm#2, if not the
npm WARN deprecated latest stable version. To upgrade to npm#2, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest-2
npm WARN deprecated
npm WARN deprecated To upgrade to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm#2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
I tried adding a ~/.npmrc file, in which I put loglevel="error", but I still get these warnings. I guess I need to put some setting in my .zshrc file. Could you point me to which one?
As far as I'm aware, the only way to suppress these warnings (from npm) is to use a version of npm that doesn't emit them.
NODE_NO_WARNINGS=1 npm install ...

Resources