In Cordova 11.1, when using the '--searchpath' command to specify the local registry address when adding a plug-in, if the added plug-in and the dependency are in the same directory, it uses the network registry instead of the same directory to search, resulting in the failure to add the plug-in and dependency correctly.
What is expected to happen?
When you specify the plug-in registry using '--serchpath', if the plug-in to be added is in the same root directory as the dependent plug-in, the registry should be searched in the same root directory first.
What does actually happen?
When the plug-in to be added is in the same root directory as the dependent plug-in, it does not search the registry in the same root directory first. Instead, it accesses the network registry search directly. As a result, the specified dependent plug-in cannot be found and stops working.
Information
Here is the command history
I hid the registry name, plugin name and version for business reason
cordova plugin add my-plugin@my-version --searchpath /Users/*****/Desktop/Workspace/SDK-4.7.16/plugins
Installing "my-plugin" for ios
Failed to install 'my-plugin': CordovaError: Failed to fetch plugin @my-registry/my-plugin-corelibs@version 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/@my-registry%2fmy-plugin-corelibs - Not found
npm ERR! 404
npm ERR! 404 '@my-registry/my-plugin-corelibs@version' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/*****/.npm/_logs/2023-03-02T09_50_45_030Z-debug-0.log
at /Users/*****/.nvm/versions/node/v18.14.2/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Failed to fetch plugin @my-registry/my-dependency@version 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/@my-registry%2fmy-plugin-corelibs - Not found
npm ERR! 404
npm ERR! 404 '@my-registry/my-plugin-corelibs@version' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/*****/.npm/_logs/2023-03-02T09_50_45_030Z-debug-0.log
Bug Report
Problem
In Cordova 11.1, when using the '--searchpath' command to specify the local registry address when adding a plug-in, if the added plug-in and the dependency are in the same directory, it uses the network registry instead of the same directory to search, resulting in the failure to add the plug-in and dependency correctly.
What is expected to happen?
When you specify the plug-in registry using '--serchpath', if the plug-in to be added is in the same root directory as the dependent plug-in, the registry should be searched in the same root directory first.
What does actually happen?
When the plug-in to be added is in the same root directory as the dependent plug-in, it does not search the registry in the same root directory first. Instead, it accesses the network registry search directly. As a result, the specified dependent plug-in cannot be found and stops working.
Information
Here is the command history I hid the registry name, plugin name and version for business reason
cordova plugin add my-plugin@my-version --searchpath /Users/*****/Desktop/Workspace/SDK-4.7.16/plugins Installing "my-plugin" for ios Failed to install 'my-plugin': CordovaError: Failed to fetch plugin @my-registry/my-plugin-corelibs@version 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/@my-registry%2fmy-plugin-corelibs - Not found npm ERR! 404 npm ERR! 404 '@my-registry/my-plugin-corelibs@version' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/
*****
/.npm/_logs/2023-03-02T09_50_45_030Z-debug-0.log at /Users/*****
/.nvm/versions/node/v18.14.2/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Failed to fetch plugin @my-registry/my-dependency@version 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/@my-registry%2fmy-plugin-corelibs - Not found npm ERR! 404 npm ERR! 404 '@my-registry/my-plugin-corelibs@version' is not in this registry. npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.npm ERR! A complete log of this run can be found in: npm ERR! /Users/
*****
/.npm/_logs/2023-03-02T09_50_45_030Z-debug-0.logCommand or Code
cordova create test-app com.myapp.basic TestApp cd test-app cordova plugin add my-plugin@my-version --searchpath /Users/
*****
/Desktop/Workspace/SDK-4.7.16/pluginsplugin.xml
Environment, Platform, Device
MacOS 13.2.1 node v18.14.2 npm v9.5.0
Version information
Cordova: Cordova CLI 11.1 cordova-ios@6.1 Self-developed plug-in MacOS Ventura 13.2.1 Graphics Intel Xcode
Checklist