Coder Social home page Coder Social logo

Comments (9)

raphinesse avatar raphinesse commented on July 28, 2024 2

@NateEag Actually we will be dropping support for npm@<5 in the next major. The code you referenced has already been removed in #80.

@misterti No, unfortunately there's no built-in way of getting even more verbose output. You could patch the version of cordova-fetch used by your cordova installation to log npmInstallOutput here:

cordova-fetch/index.js

Lines 93 to 94 in d2be930

function getTargetPackageSpecFromNpmInstallOutput (npmInstallOutput) {
const lines = npmInstallOutput.split('\n');

Or maybe you could just try installing what you are trying to install using npm install then you should be seeing any unmet dependency warnings.

from cordova-fetch.

breautek avatar breautek commented on July 28, 2024 1

or at least how can i see the underlying error

Attaching --verbose flag to any cordova command should spit out a lot of potentially useful debug information, including information from stdout of spawned processes.

Also a side note that support for NPM 3 is ending in the next major, which is already committed to master. So if there are any issues regarding NPM 3, it will likely be no longer addressed. You should consider upgrading if possible.

from cordova-fetch.

misterti avatar misterti commented on July 28, 2024

Do we have a workaround, or at least how can i see the underlying error, what is the unmet dependency?
Thanks

from cordova-fetch.

NateEag avatar NateEag commented on July 28, 2024

In my project I actually wound up removing the plugin that caused the error for unrelated reasons.

@breautek Thanks for the heads-up about npm 3. If you look at the code in question, you'll see a comment claiming that it also applies with npm 4.

As I said above, I haven't tested that, but it seems likely to me this bug will exist there too.

from cordova-fetch.

misterti avatar misterti commented on July 28, 2024

Verbose still doesn't give any usable information. I get module_not_found from async.js and then unmet\package.json at the end. Can i get even more verbose output from each step of cordova plugin add?

from cordova-fetch.

NateEag avatar NateEag commented on July 28, 2024

@raphinesse Gotcha, thanks. Good to know.

from cordova-fetch.

misterti avatar misterti commented on July 28, 2024

@raphinesse thanks, that worked perfectly. I dumped the npmInstallOutput and got all the info i needed. Doing npm install did not fail. I think a step after failed.

console.log(dump(npmInstallOutput));
where dump() is a copy from http://www.openjs.com/scripts/others/dump_function_php_print_r.php

Edit: npm install actually returns a warning for unmet peer dependencies and that breaks further steps of cordova plugin add, when it should return the module name. So i patched getTargetPackageSpecFromNpmInstallOutput and i want to share this for other poor souls suffering from this.

function getTargetPackageSpecFromNpmInstallOutput (npmInstallOutput) {
    //console.log("dump(npmInstallOutput));
    const lines = npmInstallOutput.split('\n');
    for (let i = 0; i < lines.length; i++) {
	if (lines[i].indexOf('UNMET') > -1)
		continue;
        if (lines[i].startsWith('+ ')) {
            // npm >= 5
            return lines[i].slice(2);
        } else if (lines[i].startsWith('└─') || lines[i].startsWith('`-') || lines[i].startsWith('+-')) {
            // 3 <= npm <= 4
            return lines[i].slice(4).split(' ')[0];
        }
    }
    throw new CordovaError('Could not determine package name from output:\n' + npmInstallOutput);
}

Sorry for code formatting, it just won't work
Edit: fixed, thanks breautek

from cordova-fetch.

breautek avatar breautek commented on July 28, 2024

Sorry for code formatting, it just won't work

For future reference, you can do block-level formatting by using 3 backticks ( ``` ) followed by a new line, using another 3 backticks on a new line to end the block.

from cordova-fetch.

erisu avatar erisu commented on July 28, 2024

I am closing out this ticket as we do not support npm 3.

from cordova-fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.