You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/07/14 05:41:57 UTC
[GitHub] [cordova-lib] shankari edited a comment on issue #845: cordova@8.0.0 -> cordova@9.0.0 breaks plugin installs using git repos or local directories
shankari edited a comment on issue #845:
URL: https://github.com/apache/cordova-lib/issues/845#issuecomment-657978818
The npm install command is launched using `superspawn.spawn`.
And now I come to the part that I don't understand. If I use `-d`, I can see the arguments passed in to `npm install`
```
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://github.com/phonegap/phonegap-plugin-contentsync.git"
fetch: Installing https://github.com/phonegap/phonegap-plugin-contentsync.git to /Users/kshankar/e-mission/upgrade_platform
Running command: npm install https://github.com/phonegap/phonegap-plugin-contentsync.git --production --save
Command finished with error code 0: npm install,https://github.com/phonegap/phonegap-plugin-contentsync.git,--production,--save
Failed to fetch plugin https://github.com/phonegap/phonegap-plugin-contentsync.git 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:
phonegap-plugin-contentsync@1.4.2 node_modules/phonegap-plugin-contentsync
CordovaError: Failed to fetch plugin https://github.com/phonegap/phonegap-plugin-contentsync.git 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:
phonegap-plugin-contentsync@1.4.2 node_modules/phonegap-plugin-contentsync
at /Users/kshankar/e-mission/upgrade_platform/node_modules/cordova-lib/src/plugman/fetch.js:146:43
at processTicksAndRejections (internal/process/task_queues.js:97:5)
```
If I run the exact same command using superspawn using the node REPL, I get an output with the `+`
```
$ node
Welcome to Node.js v14.5.0.
Type ".help" for more information.
> var superspawn = require('cordova-common').superspawn;
undefined
> var dest = "<redacted>"
undefined
> var args = ["install", "https://github.com/phonegap/phonegap-plugin-contentsync.git", "--production", "--save"]
undefined
> superspawn.spawn('npm', args, { cwd: dest }).then(function(output){ console.log(output); });
Promise {
promiseDispatch: [Function (anonymous)],
valueOf: [Function (anonymous)],
inspect: [Function (anonymous)]
}
> (node:59879) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
+ phonegap-plugin-contentsync@1.4.2
updated 1 package and audited 1707 packages in 11.991s
47 packages are looking for funding
run `npm fund` for details
found 173 vulnerabilities (45 low, 75 moderate, 53 high)
run `npm audit fix` to fix them, or `npm audit` for details
```
But if I add the same kind of output logging in `fetch.js`, it returns the output without the `+`
e.g. if I change the code to
```
function installPackage (target, dest, opts) {
return isNpmInstalled()
// Ensure that `npm` installs to `dest` and not any of its ancestors
.then(_ => fs.ensureDir(path.join(dest, 'node_modules')))
// Run `npm` to install requested package
.then(_ => npmArgs(target, opts))
.then(args => {
events.emit('verbose', `fetch: Installing ${target} to ${dest}`);
return superspawn.spawn('npm', args, { cwd: dest });
})
.then(function(output){ console.log("Output = "+output); return output; })
// Resolve path to installed package
.then(getTargetPackageSpecFromNpmInstallOutput)
.then(spec => pathToInstalledPackage(spec, dest));
}
```
I get the following output
```
$ npx cordova plugin -d add https://github.com/phonegap/phonegap-plugin-contentsync.git
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://github.com/phonegap/phonegap-plugin-contentsync.git"
fetch: Installing https://github.com/phonegap/phonegap-plugin-contentsync.git to /Users/kshankar/e-mission/upgrade_platform
Running command: npm install https://github.com/phonegap/phonegap-plugin-contentsync.git --production --save
Command finished with error code 0: npm install,https://github.com/phonegap/phonegap-plugin-contentsync.git,--production,--save
Output = phonegap-plugin-contentsync@1.4.2 node_modules/phonegap-plugin-contentsync
Failed to fetch plugin https://github.com/phonegap/phonegap-plugin-contentsync.git 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:
phonegap-plugin-contentsync@1.4.2 node_modules/phonegap-plugin-contentsync
CordovaError: Failed to fetch plugin https://github.com/phonegap/phonegap-plugin-contentsync.git 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:
phonegap-plugin-contentsync@1.4.2 node_modules/phonegap-plugin-contentsync
at /Users/kshankar/e-mission/upgrade_platform/node_modules/cordova-lib/src/plugman/fetch.js:146:43
at processTicksAndRejections (internal/process/task_queues.js:97:5)
```
I can't figure out why `superspawn` behaves differently in the REPL and in the script. Any thoughts?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org