3

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
hotmeatballsoup
  • 385
  • 6
  • 58
  • 136
  • 2
    Did you try `npm clean cache --force` from that same thread? BTW, `vue-cli` package is deprecated you should be installing `@vue/cli`. – Steven B. Jul 11 '20 at 01:20
  • Thanks @StevenB. (+1) I tried your suggestion but got additional errors (please see the update above). – hotmeatballsoup Jul 11 '20 at 11:47
  • 1
    I think it's supposed to be `npm cache clean --force` instead, not sure if it matters what way round they are – Daniel_Knights Jul 11 '20 at 11:50
  • Thanks @Daniel_Knights (+1) you were correct, please see my updates above for errors. I am logged into my machine as `myuser` (my homedir is `/Users/myuser`) so not sure why I wouldn't have permission to my own files... – hotmeatballsoup Jul 11 '20 at 11:52
  • 1
    The second error looks like you need to run `npm init` first so you have a package.json – Daniel_Knights Jul 12 '20 at 01:42
  • I need `package.json` to install npm? Why would `npm install -g npm` require a `package.json` in _any_ directory?! – hotmeatballsoup Jul 12 '20 at 18:35
  • Dont get me wrong - but do you have permission to write into those directories? – Estradiaz Jul 13 '20 at 12:23
  • Thanks @Estradiaz (+1) please see my update above -- it could not possibly be a permissions issue (despite the error messages). – hotmeatballsoup Jul 13 '20 at 12:54

1 Answers1

2

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.

critrange
  • 5,652
  • 2
  • 16
  • 47
  • Thanks @yash (+1) please see my update above -- it could not possibly be a permissions issue (despite the error messages). Regardng nvm, remember the end goal here is to install `@vue/cli`, can that be installed via nvm? I ask because all the docs say to install it via npm... – hotmeatballsoup Jul 13 '20 at 12:55
  • of course `nvm` is not for @vue/cli. `nvm` is a nice tool for handling node/npm versions. `nvm` handles the permission issues too. It's worth to have a try. – critrange Jul 13 '20 at 12:57
  • 1
    Ok if it's not a permission issue, it's really related to the way you installed nodejs or the version, etc. I strongly recommend to uninstall nodejs and install `node/npm` with `nvm`. – critrange Jul 13 '20 at 12:59
  • OK, I'll give it a try -- what specific commands should I use to uninstall nodejs, then install nvm, then install npm (via nvm)? I ask because (just for background context) this is easily the ~4th time I've gone to install npm on a machine (and I've used several different laptops overt the years) and I've actually **never** successfully installed in and gotten it to work, ever! So if you can tell me what specifically to execute, I can give each command a try and report if there are any issues, that might give us some more details. Thanks again for all the help so far! – hotmeatballsoup Jul 13 '20 at 13:06
  • np :) you are on mac os? – critrange Jul 13 '20 at 13:06
  • Yes! High Sierra 10.13.6 – hotmeatballsoup Jul 13 '20 at 13:07
  • for uninstall - https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/ – critrange Jul 13 '20 at 13:08
  • for install - https://nodesource.com/blog/installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu/ – critrange Jul 13 '20 at 13:09
  • OMG what a mess!!! That article wants me to make **fifteen (15)** different _manual_ deletes to various npm-related folders around my machine!!! npm doesn't have a simple uninstaller?!?! What year was this thing built in, 1985? Give me a little while I will be back once I get them all uninstalled – hotmeatballsoup Jul 13 '20 at 13:12
  • just to ensure all things are get cleared correctly, that's manual uninstall – critrange Jul 13 '20 at 13:16
  • I had same issue and you saved me. Thanks @yash – NeK Jul 13 '20 at 13:22
  • OK @yash I was able to delete node and I just tried installing nvm and it doesn't seem to be installing, please see my updates above. – hotmeatballsoup Jul 13 '20 at 13:24
  • if I open a terminal and run `~/.bash_profile` I get `-bash: /Users/myuser/.bash_profile: Permission denied` – hotmeatballsoup Jul 13 '20 at 13:29
  • oh are you sure you are admin? – critrange Jul 13 '20 at 13:32
  • there is 1 and only 1 account on this machine (no guests, no admin, etc.) its a personal laptop that I bought and setup myself a few years ago and I've never created any other account/profiles on it. i'm logged in as `myuser` and should have full access to everything under `/Users/myuser`. When I `ls -al ~` I see that `~/.bash_profile` has the following permissions: `-rw-r--r-- 1 myuser staff 2255 Jul 1 11:51 .bash_profile`. – hotmeatballsoup Jul 13 '20 at 13:35
  • `/Users/myuser/.bash_profile: Permission denied` - this error exactly means u dont have permission of the file... – critrange Jul 13 '20 at 13:38
  • So whats a fail-proof way I could give my user permission to run `~/.bash_profile`? – hotmeatballsoup Jul 13 '20 at 13:40
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/217743/discussion-between-yash-and-hotmeatballsoup). – critrange Jul 13 '20 at 13:42
  • 1
    @hotmeatballsoup everything is OK? – critrange Jul 14 '20 at 14:45
  • Hi @yash (+1) can you see the last comment from our discussion the other day? after i restarted the terminal, `@vue/cli` is no longer installed! i can reinstall it using the commands you provided, and use it to create a VueJS project. but the minute I restart the terminal, vue no longer seems installed and I have to reinstall it each time! – hotmeatballsoup Jul 16 '20 at 13:56