apla / me.apla.cordova.app-preferences

App preferences plugin for cordova
Apache License 2.0
201 stars 210 forks source link

Regression during install: Getting error while trying to retrieve path.parse from npm #98

Closed shankari closed 7 years ago

shankari commented 7 years ago

While trying to install the plugin, @sunil07t and I got the error.

Failed to install 'cordova-plugin-app-preferences':Error: Cannot find module 'path-parse'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:77:12)
    at module.exports (/Users/.../e-mission-phone/plugins/cordova-plugin-app-preferences/bin/before_plugin_install.js:7:19)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:187:18)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:165:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:133:20
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)

Error: Cannot find module 'path-parse'

This dependency was introduced by https://github.com/apla/me.apla.cordova.app-preferences/commit/946655c066d7f4d1f339718a7dba7bda48308a6c, committed two days ago.

We were able to workaround by cloning locally and checking out the version just before that commit, but this seems like a serious regression.

shankari commented 7 years ago

I am not quite sure why this doesn't work though - there is a path-parse module https://www.npmjs.com/package/path-parse and its current version is 1.0.5.

I think that npm is supposed to install all the dependencies in package.json automatically, so that we don't have to install them manually using npm install...

apla commented 7 years ago

I'll add path-parse to the package contents, so external dependency is not needed in near future. Currently I want to update plugin with all available changes, but it is WIP, and package will be broken sometimes at master branch.

shankari commented 7 years ago

I completely understand. I tried installing from npm with a version and it didn't work today morning, but it worked now. I must have done something wrong.

I don't understand why adding it to packages.json doesn't work, though. It seems to work for the other packages, and the module is in npm...