Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin installation fails with a registry fetch error when run using through execSync and npm 8.15.0 #148

Open
3 tasks done
fortinmike opened this issue Oct 10, 2022 · 0 comments

Comments

@fortinmike
Copy link

Bug Report

Problem

What is expected to happen?

Plugin installation should succeed.

What does actually happen?

Plugin installation fails with a registry fetch error (but the plugin is in the registry). It sometimes succeeds on the second try, as if the first time it didn't wait for the fetch to finish before making sure the plugin exists on disk. Installation of all plugins fails in the same manner, it's not just this one.

Information

Here is the error:

Running command: npm install [email protected] --production --no-save
Command finished with error code 0: npm install,[email protected],--production,--no-save
Failed to fetch plugin [email protected] via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Could not determine package name from output:
added 1 package, removed 1 package, and audited 2 packages in 1s

found 0 vulnerabilities
CordovaError: Failed to fetch plugin [email protected] via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Could not determine package name from output:
added 1 package, removed 1 package, and audited 2 packages in 1s

found 0 vulnerabilities
    at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/cordova-lib/src/plugman/fetch.js:146:43
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
node:child_process:915
    throw err;
    ^

Error: Command failed: node_modules/.bin/plugman -d install --platform android --project platforms/android --plugin [email protected] --plugins_dir=plugins
    at checkExecSyncError (node:child_process:841:11)
    at execSync (node:child_process:912:15)
    at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/scripts/install-plugins.js:29:5
    at arrayEach (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:530:11)
    at Function.forEach (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:9410:14)
    at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/scripts/install-plugins.js:28:5
    at /Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:3032:24)
    at Function.forOwn (/Users/michael/Projects/Software/Simbioz/Ripple.Base/ripple/rcc/node_modules/.pnpm/[email protected]/node_modules/lodash/lodash.js:13082:24) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 37257,
  stdout: null,
  stderr: null
}
 ELIFECYCLE  Command failed with exit code 1.

Workaround

It seems like the problem occurs because something goes wrong when plugman uses npm 8.5 while being run by execSync (in a script). If I install npm 6.X locally in the project (npm install --save-dev [email protected]), the plugman script uses that internally and installation succeeds. However, it forces me to downgrade npm to v6 for my whole project instead of staying on npm 8 which is the default for node 16.

Command or Code

execSync(
    `node_modules/.bin/plugman -d install --platform android --project platforms/android --plugin [email protected] --plugins_dir=plugins`,
    { stdio: "inherit" }
);

Environment, Platform, Device

macOS 12.6 (21G115)

Version information

node 16.17.1
npm 8.15.0
plugman 3.0.1
cordova 11.0.0
cordova-android 10.1.2
cordova-ios 6.2.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant