Failed to get absolute path to installed module

Remove the plugin, you installed from local, from the config.xml, the package.json and the package-lock.json.

Then try again. I work for most of cases.

{
    "name": "io.cordova.hellocordova",
    "version": "1.0.0",
    "displayName": "HelloCordova",
    "cordova": {
        "platforms": [
            "android"
        ],
        "plugins": {
            "cordova-plugin-whitelist": {},
            "com-example-plugin": {}
        }
    },
    "dependencies": {
        "cordova-android": "^6.2.3",
        "cordova-plugin-template": "file:../cordova-testplugin",  // <-- remove this line
        "cordova-plugin-whitelist": "^1.3.2"
    }
}

I got the same error message when adding a local plugin: Error: Failed to get absolute path to installed module.

Using the option --nofetch ([email protected]) fixed it:

cordova plugin add ../my-plugin --nofetch

According to https://github.com/apache/cordova-cli/blob/master/RELEASENOTES.md : Use --nofetch flag to fetch platforms and plugins using old fetching logic.


Edit: This answer is outdated. Please use the answer of uutrecht instead.


I had the same problem right now. I fixed it by downgrading cordova from v7.0.0 to v6.5.0

npm i -g [email protected]

They changed the way how they fetch the plugins. https://cordova.apache.org/news/2017/05/04/cordova-7.html


--nofetch option has been removed in Cordova version 8.0.0: https://issues.apache.org/jira/browse/CB-13055

If you have already installed Cordova 8.x.x then you can downgrade it to version 7.1.0 and then use the --nofetch option.

Run the following command to downgrade Cordova to 7.1.0:

npm install -g [email protected]

If the above command doesn't work, then try uninstalling cordova at first and then install cordova version 7.1.0:

npm uninstall -g cordova
npm install -g [email protected]

Then, check the Cordova version to confirm if it's downgraded or not:

cordova --version