1

I'm struggling with cordova and npm clis errors. I know this is a very common error: I get this error on daily basis on different project and platform.

I noticed my Ionic1 application, which use crosswalk-webview, works with Android 6 but crash with Android 7 (it seems a known bug). Those are the steps I tried:

  • I tried to remove and re-add crosswalk-webview: cordova plugin rm cordova-plugin-crosswalk-webview cordova plugin add cordova-plugin-crosswalk-webview I get an npm error on adding the plugin: npm verb stack Error: EPERM: operation not permitted, rename...

  • the build fails: ionic cordova build --release android with the same error: Error: EPERM: operation..

  • since several plugin are outdated, I thought to remove and re-add the whole platform android cordova platform rm android Almost 1 hour later the command is still stuck so I terminated it.

Now if I try to add android as platform I get an error: Error: EPERM: operation not permitted, rename...

I tried to downgrade npm, I tried the following 5.6.0, 5.5.1, 5.4.2, 5.3.0, 5.0.0, 4.6.0 release. I reinstalled node, cordova, ionic, I cleared npm cache. I do not solved. It's clearly an NPM issue, maybe here somewhere knows how to solve..

At the current state, if I try: cordova platform add android

I get: Error: EPERM: operation not permitted, rename 'C:\nodejs\myapp\node_modules\.staging\cordova-android-78ae6d2a\node_modules\cordova-registry-mapper' The "funny" part if I simply rerun cordova platform add android multiple times I get the error "EPERM: operation not permitted" on different modules.

I'm out of ideas.

alfredopacino
  • 2,979
  • 9
  • 42
  • 68

1 Answers1

5

I have had the same problem when developing my ionic app, and trying to install some packages. I tried many times to remove and install packages again but everything was unsuccessful.

This solution worked for me :

  1. I deleted the "node_modules" folder, then added "node" to the exclusions in my Antivirus settings"
  2. I opened the command line as Administrator
  3. npm cache clean --force
  4. npm install -g npm@latest
  5. npm install --force

Then, you can try to remove the android platform, add it again and remove the cordova plugin.

By the way, there are many questions related to npm, eg., here, and here.

Bill
  • 315
  • 3
  • 18