Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM install fails for @vue/cli with Error: EPERM: operation not permitted, rename #2468

Closed
pkum11 opened this issue Sep 8, 2018 · 21 comments

Comments

@pkum11
Copy link

pkum11 commented Sep 8, 2018

Version

3.0.1

Reproduction link

http://nolink

Node and OS info

Node v8.11.4 / Windows 7

Steps to reproduce

npm install -g @vue/cli

What is expected?

Successful install

What is actually happening?

Error: EPERM: operation not permitted, rename


tried running as admin but still same error

end lines from log
8917 verbose unlock done using C:\Users\pkumar\AppData\Roaming\npm-cache_locks\staging-64e07ed02ac4e2e4.lock for C:\Users\pkumar\AppData\Roaming\npm\node_modules.staging
8918 verbose stack Error: EPERM: operation not permitted, rename 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702' -> 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json'
8919 verbose cwd C:\Users\pkumar\workspace\NodeJs\VUE\vue-cli3
8920 verbose Windows_NT 6.1.7601
8921 verbose argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "@vue/cli"
8922 verbose node v8.11.4
8923 verbose npm v5.6.0
8924 error path C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702
8925 error code EPERM
8926 error errno -4048
8927 error syscall rename
8928 error Error: EPERM: operation not permitted, rename 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702' -> 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json'
8928 error { Error: EPERM: operation not permitted, rename 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702' -> 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json'
8928 error cause:
8928 error { Error: EPERM: operation not permitted, rename 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702' -> 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json'
8928 error errno: -4048,
8928 error code: 'EPERM',
8928 error syscall: 'rename',
8928 error path: 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702',
8928 error dest: 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json' },
8928 error stack: 'Error: EPERM: operation not permitted, rename 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702' -> 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json'',
8928 error errno: -4048,
8928 error code: 'EPERM',
8928 error syscall: 'rename',
8928 error path: 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json.189012702',
8928 error dest: 'C:\Users\pkumar\AppData\Roaming\npm\node_modules\rimraf\package.json' }
8929 error Please try running this command again as root/Administrator.
8930 verbose exit [ -4048, true ]

@pkum11
Copy link
Author

pkum11 commented Sep 8, 2018

@pkum11
Copy link
Author

pkum11 commented Sep 8, 2018

Update on this
After looking at the log error msg
I ran
npm install -g decompress-tar

and then reran npm install -g @vue/cli and it worked so above pkg was not getting installed via cli process

@haoqunjiang
Copy link
Member

haoqunjiang commented Sep 8, 2018

Seems like an npm issue:
expo/create-react-native-app#191
Medium/phantomjs#19
npm/npm#10826
https://blogs.msdn.microsoft.com/matt-harrington/2012/02/23/how-to-fix-node-js-npm-permission-problems/

Some possible solutions worth a try:

  • Disable all anti-virus softwares
  • npm cache clean --force
  • Close any Node.js process and retry with a new prompt window

@daysv
Copy link

daysv commented Sep 25, 2018

npm cache clean -force

@AleksueiR
Copy link

Can't disable the antivirus; cleaning npm cache and running as admin doesn't help.

@larizzatg
Copy link

I tough I was going crazy, can't install either. I clear the cache, run as admin, remove @VUE from roaming and nothing helps...

@larizzatg
Copy link

larizzatg commented Oct 25, 2018

@AleksueiR after a lot of trial/error this works:

execute npm config edit
look for the entry
cache-lock-retries=10

set the value to 1000 (or any bigger number)
cache-lock-retries=1000

@AleksueiR
Copy link

AleksueiR commented Oct 26, 2018

@skayablars Thanks! I'll try that. This totally makes sense though - McAfee is likely locking files trying to scan them.

I was getting nowhere with this yesterday and ended up installing vue-cli on a VM, and then copying the
@vue folder from Roaming/npm over to my machine. That worked, butt's very clumsy.

@larizzatg
Copy link

@skayablars Thanks! I'll try that. This totally makes sense though - McAfee is likely locking files trying to scan them.

I was getting nowhere with this yesterday and ended up installing vue-cli on a VM, and then copying the
@vue folder from Roaming/npm over to my machine. That worked, butt's very clumsy.

Something that I forgot to say is that I contact support in my company to disable McAfee while I resolved the issue

@bparavatti
Copy link

Try run: npm uninstall vue-cli -g
After run again npm install -g @vue/cli

That's works for me

@joelvarma
Copy link

sudo chown -R myusername: /usr/local/lib/node_modules

This worked for me!

@Huander
Copy link

Huander commented Feb 13, 2019

Solution: yarn global add @vue/cli

@Damanharneet
Copy link

nothing is working from me.
cache cleaned
disabled antivirus

can you please help me

@abbrechen
Copy link

abbrechen commented May 7, 2019

I have the same error when I try to build my vue-cli app. Installing the dependencies and serving the app works fine. But ...

Error: EPERM: operation not permitted, lstat '[PATH_TO_PROJECT]\dist'

appears on Windows 10. Didnt try with Apple and Linux yet.

What I have tried:

  • npm cache clean --force
  • edit npm config
  • uninstall and install vue-cli
  • run npm run build with system32 rights

EDIT: My solution is linked in @sodatea 's answer: npm/npm#10826 (comment) I closed the Atom Editor

@Damanharneet
Copy link

I tried all of them like you but at last this thing for me
Delete node module folder in user\my.username\AppData\Roaming\npm

Let me know if it works for you

@meresey
Copy link

meresey commented Sep 18, 2019

I had the same issue but using PS as admin as opposed to CMD as admin seems to have worked. No idea how or why.

@wontivero
Copy link

Try this command :

npm install -g @vue/cli --cache /tmp/empty-cache

to use a temporary cache instead of nuking the actual one.
It worked for me.

@rikvli
Copy link

rikvli commented Mar 31, 2020

Same issue here. Win10. A system restart solves my problem.....

@Maxwell-Dan
Copy link

Seems like an npm issue:
expo/create-react-native-app#191
Medium/phantomjs#19
npm/npm#10826
https://blogs.msdn.microsoft.com/matt-harrington/2012/02/23/how-to-fix-node-js-npm-permission-problems/

Some possible solutions worth a try:

  • Disable all anti-virus softwares
  • npm cache clean --force
  • Close any Node.js process and retry with a new prompt window

thanks npm cache clean --force works for me

@le-cardinal
Copy link

same issue. nothing is working.
what's the hell ?

@timefordroids
Copy link

I had the same issue. The following command worked for me:
npm install -g @vue/cli --unsafe-perm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests