简体   繁体   中英

Can't install plugin NPM

I have a cordova ionic application. I'm trying to install a plugin. I'm not able to. The error I have happens on any plugins I try to install really. It happens when I also try to delete a platform for example or run the application on Android. It just happens all the time. I can't figure out how to fix it. I've tried cleaning the cache, moving the cache location, running everything as administrator, giving full permission to my folder and all its children. I'm using Windows 10 as an administrator.

PS C:\Users\mario\Desktop\scmobileapppublic> cordova plugin add cordova-plugin-file-transfer
Error: Failed to fetch plugin cordova-plugin-file-transfer via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963248 Error output:
npm ERR! path C:\Users\mario\Desktop\scmobileapppublic\node_modules\fsevents\node_modules\aws4\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\mario\Desktop\scmobileapppublic\node_modules\fsevents\node_modules\aws4\package.json'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, unlink 'C:\Users\mario\Desktop\scmobileapppublic\node_modules\fsevents\node_modules\aws4\package.json'
npm ERR!     at Error (native)
npm ERR!   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\mario\\Desktop\\scmobileapppublic\\node_modules\\fsevents\\node_modules\\aws4\\package.json\'\n    at Error (native)',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\\Users\\mario\\Desktop\\scmobileapppublic\\node_modules\\fsevents\\node_modules\\aws4\\package.json' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\mario\AppData\Roaming\npm-cache\_logs\2017-08-31T21_18_02_104Z-debug.log

Any help would be appreciated! Thank you

Do not know why, but those steps worked for me :

-> remove node_modules folder inside AppData/roaming/npm

-> open terminal as admin and do following cmd :

npm cache clean --force

Be in mind that will delete all your packages installed globally, Ionic and Cordova in our case. So you'll need to reinstall them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM