apache / apache/cordova-cli

'--searchpath' not working properly on Cordova 10.0

Open
#539 12 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
967
Forks
344
Avg merge
8h 41m
Merged PRs (30d)
9

Description

## Problem

I am trying to adapting our product with Cordova CLI 10. After upgrading to CLI 10.0, when adding plugin in cordova project using '--searchpath' parameter, query on registry will be hit before on local search path

### What is expected to happen?

'--searchpath' should help the command query the folder I set before querying on the registry

### What does actually happen?

'--searchpath' is hitting registry before local folder. This is not consistent with the [definition](https://cordova.apache.org/docs/en/latest/reference/cordova-cli/#cordova-plugin-command) of this parameter

## Information
Here is the command history

I hid the registry name, plugin name and version for business reason

cordova plugin add \@\ --searchpath /Users/*****/Documents/SDK/plugins
Installing "\" for android
Failed to install '\': CordovaError: Failed to fetch plugin @\/\@\ via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@%2f - Not found
npm ERR! 404
npm ERR! 404 '@\/\@\ ' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

### Environment, Platform, Device
MacOS 10.15.7
npm v6.14.7
node v14.4.0

### Version information

Cordova CLI 10.0.0

## Checklist

- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing `cordova plugin add @ --searchpath ` with Cordova CLI 10.0, using the reported macOS, Node.js, and npm versions. Trace the plugin-add search order and verify that the local search path is checked before the registry, then confirm the command installs the local plugin without the registry lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.