wikitude-cordova-plugin icon indicating copy to clipboard operation
wikitude-cordova-plugin copied to clipboard

npm error: name can no longer contain capital letters

Open Ponsen opened this issue 5 years ago • 1 comments

The following error occours when preparing a cordova project:

npm ERR! code E404
npm ERR! 404 Not found : com.wikitude.phonegap.WikitudePlugin
npm ERR! 404
npm ERR! 404  'com.wikitude.phonegap.WikitudePlugin' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404  1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

To reproduce the issue do the following:

  • create a new cordova project
  • add wikitude plugin from npm
  • add a platform (both platform and plugins are stored in package.json, so we can restore the project)
  • remove node_modules, platforms, plugins folders and package-lock.json
  • restore project by preparing previously added platform (e.g. cordova prepare android)

Outcome: When cordova/npm tries to restore the wikitude plugin, it fails. Other plugins work.

My Environment:

Detailed test log:

  Show all details
PS C:\workspace\temp\test> cordova create testapp
Creating a new cordova project.
PS C:\workspace\temp\test> cd .\testapp\
PS C:\workspace\temp\test\testapp> cordova platform add android
Using cordova-fetch for cordova-android@^8.0.0
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.cordova.hellocordova
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-28
Subproject Path: CordovaLib
Android project created with [email protected]
Plugin 'cordova-plugin-whitelist' found in config.xml... Migrating it to package.json
Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project
Installing "cordova-plugin-whitelist" for android
PS C:\workspace\temp\test\testapp> cordova plugin add com.wikitude.phonegap.wikitudeplugin
Installing "com.wikitude.phonegap.WikitudePlugin" for android
Subproject Path: CordovaLib
Subproject Path: app

            Make sure that you enter your Wikitude SDK trial license key in `WikitudePlugin.js` line 12. If you havent bought a license please visit http://www.wikitude.com/store.

            If you want to contribute to the open source project, please visit us at github, http://github.com/Wikitude
Adding com.wikitude.phonegap.WikitudePlugin to package.json
PS C:\workspace\temp\test\testapp> rm .\node_modules\
PS C:\workspace\temp\test\testapp> rm .\platforms\
PS C:\workspace\temp\test\testapp> rm .\package-lock.json
PS C:\workspace\temp\test\testapp> rm .\plugins\
PS C:\workspace\temp\test\testapp> cordova prepare android
Discovered platform "android@^8.1.0" in config.xml or package.json. Adding it to the project
Using cordova-fetch for cordova-android@^8.1.0
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.cordova.hellocordova
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-28
Subproject Path: CordovaLib
Subproject Path: app
Android project created with [email protected]
Discovered saved plugin "cordova-plugin-whitelist". Adding it to the project
Installing "cordova-plugin-whitelist" for android
Discovered saved plugin "com.wikitude.phonegap.WikitudePlugin". Adding it to the project
Failed to restore plugin "com.wikitude.phonegap.WikitudePlugin" from config.xml. You might need to try adding it again. Error: Error: npm: Command failed with exit code 1 Error output:
npm ERR! code E404
npm ERR! 404 Not found : com.wikitude.phonegap.WikitudePlugin
npm ERR! 404
npm ERR! 404  'com.wikitude.phonegap.WikitudePlugin' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404  1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Ponsen avatar Nov 13 '19 10:11 Ponsen

Thanks for the note. I think this comes from the fact that the plugin-id in the plugin.xml still contains capital letters and that cordova uses that information to then trigger npm. Will create a corresponding PR for this internally.

pnagele avatar Nov 13 '19 20:11 pnagele