Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install vue-cli because infinite loop of npm issues

Brand new to VueJS and am trying to install vue-cli as it is my understanding that it is the minimal requirement to build a VueJS application.

I run:

$ npm install --global vue-cli
Unhandled rejection Error: EACCES: permission denied, open '/Users/myuser/.npm/_cacache/tmp/2e41a7b1'

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

I found this SO answer here which recommends running:

$ npm i --no-package-lock
npm WARN saveError ENOENT: no such file or directory, open '/Users/myuser/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/myuser/package.json'
npm WARN myuser No description
npm WARN myuser No repository field.
npm WARN myuser No README data
npm WARN myuser No license field.

up to date in 0.374s
found 0 vulnerabilities



   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │       New minor version of npm available! 6.9.0 → 6.14.6       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.14.6   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

So then I go to upgrade npm:

$ npm install -g npm
Unhandled rejection Error: EACCES: permission denied, open '/Users/myuser/.npm/_cacache/tmp/54213b04'

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

...and I'm right back to where I started! What's going on here?!


Update

When I try to force a clean cache I also get errors:

$ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
npm ERR! path /Users/myuser/.npm/_cacache/content-v2
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rmdir
npm ERR! Error: EACCES: permission denied, rmdir '/Users/myuser/.npm/_cacache/content-v2'
npm ERR!  [OperationalError: EACCES: permission denied, rmdir '/Users/myuser/.npm/_cacache/content-v2'] {
npm ERR!   cause: [Error: EACCES: permission denied, rmdir '/Users/myuser/.npm/_cacache/content-v2'] {
npm ERR!     errno: -13,
npm ERR!     code: 'EACCES',
npm ERR!     syscall: 'rmdir',
npm ERR!     path: '/Users/myuser/.npm/_cacache/content-v2'
npm ERR!   },
npm ERR!   isOperational: true,
npm ERR!   stack: "Error: EACCES: permission denied, rmdir '/Users/myuser/.npm/_cacache/content-v2'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'rmdir',
npm ERR!   path: '/Users/myuser/.npm/_cacache/content-v2'
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 (though this is not recommended).

Update regarding potential permissions issue

Remember this is my own user's home directory, so I should absolutely have full access/privilege to use and have been using this laptop for years without any issues.

When I cd into /Users and run ls -al I get:

$ ls -al
total 0
drwxr-xr-x    5 root     admin   160 Apr  9  2018 .
drwxr-xr-x   30 root     wheel   960 May  2  2019 ..
-rw-r--r--    1 root     wheel     0 Jul 15  2017 .localized
drwxrwxrwt    5 root     wheel   160 Apr  9  2018 Shared
drwxr-xr-x+ 117 myuser   staff  3744 Jul 11 11:14 myuser

So again this could not possibly be an actual permission issue.


Update for trying to uninstall node and install nvm

I was able to follow this link to manually delete node/npm off my system. I then tried following this link to install nvm and it doesn't seem to work for me:

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11329  100 11329    0     0  33913      0 --:--:-- --:--:-- --:--:-- 34123
=> Downloading nvm from git to '/Users/myuser/.nvm'
=> Cloning into '/Users/myuser/.nvm'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 7748 (delta 0), reused 1 (delta 0), pack-reused 7747
Receiving objects: 100% (7748/7748), 2.63 MiB | 1.77 MiB/s, done.
Resolving deltas: 100% (4905/4905), done.
* (HEAD detached at v0.33.0)
  master
=> Compressing and cleaning up git repository
Counting objects: 7748, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7684/7684), done.
Writing objects: 100% (7748/7748), done.
Total 7748 (delta 5188), reused 2329 (delta 0)

=> Appending nvm source string to /Users/myuser/.bashrc
=> bash_completion source string already in /Users/myuser/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="/Users/myuser/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

So I close my terminal and restart it and then run:

$ nvm --version
-bash: nvm: command not found
like image 655
hotmeatballsoup Avatar asked Dec 17 '25 11:12

hotmeatballsoup


1 Answers

It looks you don't have permission to the directory:

cd /Users/myuser
chown -R $USER ./.npm

And please try again.

If it doesn't work, I recommend to remove your nodejs totally and install nvm and install nodejs using nvm.

like image 158
topmoon Avatar answered Dec 20 '25 07:12

topmoon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!