Ionic cordova platform add android: npm ERR! Error: EPERM: operation not permitted, lstat


#1

I am getting the same error after updating npm.

$ ionic cordova build android --verbose --debug
[DEBUG] Loading global plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for global @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
[DEBUG] Getting plugin info for ionic
[DEBUG] Getting plugin info for @ionic/cli-plugin-cordova
[DEBUG] Getting plugin info for @ionic/cli-plugin-ionic-angular
[DEBUG] Checking for latest plugin version of ionic@latest.
[DEBUG] Checking for latest plugin version of @ionic/cli-plugin-cordova@latest.
[DEBUG] Checking for latest plugin version of
        @ionic/cli-plugin-ionic-angular@latest.
[DEBUG] Latest version of ionic@latest is 3.4.0.
[DEBUG] Latest version of @ionic/cli-plugin-ionic-angular@latest is 1.3.1.
[DEBUG] Latest version of @ionic/cli-plugin-cordova@latest is 1.4.0.
Running app-scripts build: --iscordovaserve --externalIpRequired --nobrowser

[15:23:47]  build dev started ...
[15:23:48]  clean started ...
[15:23:48]  clean finished in 1 ms
[15:23:48]  copy started ...
[15:23:48]  transpile started ...
[15:23:54]  transpile finished in 6.63 s
[15:23:54]  preprocess started ...
[15:23:54]  deeplinks started ...
[15:23:54]  deeplinks finished in 47 ms
[15:23:54]  preprocess finished in 47 ms
[15:23:54]  webpack started ...
[15:23:55]  copy finished in 7.14 s
[15:24:03]  webpack finished in 8.91 s
[15:24:03]  sass started ...
[15:24:04]  sass finished in 861 ms
[15:24:04]  postprocess started ...
[15:24:04]  postprocess finished in less than 1 ms
[15:24:04]  lint started ...
[15:24:04]  build dev finished in 16.50 s
> cordova build android --debug
\ Running command [15:24:09]  lint finished in 4.81 s
✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[DEBUG] !!! ERROR ENCOUNTERED !!!
[ERROR] An error occurred while running cordova build android --debug (exit code
        1):

        (truncated) ... roblem, 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:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\node_modules\fsevents\node_modules\getpass\node_modules
        npm ERR! code EPERM
        npm ERR! errno -4048
        npm ERR! syscall lstat
        npm ERR! Error: EPERM: operation not permitted, lstat
        'C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\node_modules\fsevents\node_modules\getpass\node_modules'
        npm ERR!     at Error (native)
        npm ERR!  { Error: EPERM: operation not permitted, lstat
        'C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\node_modules\fsevents\node_modules\getpass\node_modules'
        npm ERR!     at Error (native)
        npm ERR!   stack: 'Error: EPERM: operation not permitted, lstat
        \'C:\\lakshmanan\\Test\\TestRepo\\AnimalTrackerApp\\UserApplication\\node_modules\\fsevents\\node_modules\\getpass\\node_modules\'\n
        at Error (native)',
        npm ERR!   errno: -4048,
        npm ERR!   code: 'EPERM',
        npm ERR!   syscall: 'lstat',
        npm ERR!   path:
        'C:\\lakshmanan\\Test\\TestRepo\\AnimalTrackerApp\\UserApplication\\node_modules\\fsevents\\node_modules\\getpass\\node_modules'
        }
        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\lakshmanank\AppData\Roaming\npm-cache\_logs\2017-07-07T09_55_47_654Z-debug.log
        Discovered plugin "ionic-plugin-keyboard" in config.xml. Adding it to
        the project
        Installing "ionic-plugin-keyboard" for android
        ANDROID_HOME=C:/Users/Administrator/AppData/Local/Android/sdk/
        JAVA_HOME=C:/Program Files/Java/jdk1.8.0_111/
        :wrapper

        BUILD SUCCESSFUL

        Total time: 3.029 secs
        Subproject Path: CordovaLib
        The Task.leftShift(Closure) method has been deprecated and is scheduled
        to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at
        build_3o65ouaikvlfanpbb4bb3rfkb.run(C:\lakshmanan\Test\TestRepo\AnimalTrackerApp\UserApplication\platforms\android\build.gradle:137)
        The JavaCompile.setDependencyCacheDir() method has been deprecated and
        is scheduled to be removed in Gradle 4.0.
        Incremental java compilation is an incubating feature.
        The TaskInputs.source(Object) method has been deprecated and is
        scheduled to be removed in Gradle 4.0. Please use
        TaskInputs.file(Object).skipWhenEmpty() instead.
        :preBuild UP-TO-DATE
        :preDebugBuild UP-TO-DATE
        :checkDebugManifest
        :CordovaLib:preBuild UP-TO-DATE
        :CordovaLib:preDebugBuild UP-TO-DATE
        :CordovaLib:checkDebugManifest
        :CordovaLib:prepareDebugDependencies
        :CordovaLib:compileDebugAidl
        :CordovaLib:compileDebugNdk UP-TO-DATE
        :CordovaLib:compileLint
        :CordovaLib:copyDebugLint UP-TO-DATE
        :CordovaLib:mergeDebugShaders
        :CordovaLib:compileDebugShaders
        :CordovaLib:generateDebugAssets
        :CordovaLib:mergeDebugAssets
        :CordovaLib:mergeDebugProguardFiles
        :CordovaLib:packageDebugRenderscript UP-TO-DATE
        :CordovaLib:compileDebugRenderscript
        :CordovaLib:generateDebugResValues
        :CordovaLib:generateDebugResources
        :CordovaLib:packageDebugResources
        :CordovaLib:processDebugManifest
        :CordovaLib:generateDebugBuildConfig
        :CordovaLib:processDebugResources
        :CordovaLib:generateDebugSources
        :CordovaLib:incrementalDebugJavaCompilationSafeguard
        :CordovaLib:compileDebugJavaWithJavac
        :CordovaLib:compileDebugJavaWithJavac - is not incremental (e.g. outputs
        have changed, no previous execution, etc.).
        Note: Some input files use or override a deprecated API.
        Note: Recompile with -Xlint:deprecation for details.
        :CordovaLib:processDebugJavaRes UP-TO-DATE
        :CordovaLib:transformResourcesWithMergeJavaResForDebug
        :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
        :CordovaLib:mergeDebugJniLibFolders
        :CordovaLib:transformNative_libsWithMergeJniLibsForDebug
        :CordovaLib:transformNative_libsWithSyncJniLibsForDebug
        :CordovaLib:bundleDebug
        :prepareOrgApacheCordovaCordovaLib623DebugLibrary
        :prepareDebugDependencies
        :compileDebugAidl
        :compileDebugRenderscript
        :generateDebugBuildConfig
        :generateDebugResValues
        :generateDebugResources
        :mergeDebugResources
        :processDebugManifest
        :processDebugResources
        :generateDebugSources
        :incrementalDebugJavaCompilationSafeguard
        :compileDebugJavaWithJavac
        :compileDebugJavaWithJavac - is not incremental (e.g. outputs have
        changed, no previous execution, etc.).
        :compileDebugNdk UP-TO-DATE
        :compileDebugSources
        :mergeDebugShaders
        :compileDebugShaders
        :generateDebugAssets
        :mergeDebugAssets
        :transformClassesWithDexForDebug
        :mergeDebugJniLibFolders
        :transformNative_libsWithMergeJniLibsForDebug
        :processDebugJavaRes UP-TO-DATE
        :transformResourcesWithMergeJavaResForDebug
        :validateSigningDebug
        :packageDebug
        :assembleDebug
        :cdvBuildDebug

        BUILD SUCCESSFUL

        Total time: 10.182 secs
        Built the following apk(s):

Error: Failed to fetch platform cordova-android@^6.2.3
#2

What is your ´ionic info` output?
What software are you running while doing that command? VS Code maybe? Close it.