pwa-builder / PWABuilder-CLI

Node.js tool for App Generation
Other
1.63k stars 142 forks source link

pwabuilder fails when domain name fragment starts with a number (e.g. beta.3r.org.uk) #300

Open Dan-Q opened 6 years ago

Dan-Q commented 6 years ago

I've a working pwabuilder installation which functions for other projects, but running the following fails:

pwabuilder https://beta.3r.org.uk/ -s "Beta3R" -l debug -p android

From the trace below, you'll note that the "Package" name has been set to "uk.org.r.beta" when it should have been set to "uk.org.3r.beta"; I suspect that some overenthusiastic correction is going on somewhere, but I'm not familiar enough with the codebase to understand where to start looking for the problem.

Relevant part of output:

[debug] pid:11596   : Creating Cordova project for the Android platform:
[debug] pid:11596   :   Path: platforms/android
[debug] pid:11596   :   Package: uk.org.r.beta
[debug] pid:11596   :   Name: Beta3R
[debug] pid:11596   :   Activity: MainActivity
[debug] pid:11596   :   Android target: android-23
[debug] pid:11596   : Android project created with cordova-android@5.1.1
[debug] pid:11596   : Installing "cordova-plugin-hostedwebapp" for android
[debug] pid:11596   : Installing "cordova-plugin-whitelist" for android
[debug] pid:11596   :
[debug] pid:11596   :                This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
[debug] pid:11596   :
[debug] pid:11596   : Fetching plugin "cordova-plugin-network-information" via npm
[debug] pid:11596   : Installing "cordova-plugin-network-information" for android
[debug] pid:11596   : Plugin "cordova-plugin-whitelist" already installed on android. Making it top-level.
[debug] pid:11596   : Updating Cordova configuration from W3C manifest...
[debug] pid:11596   : Error: Cannot read property 'toLowerCase' of undefined
[error] pwabuilder  : Failed to create the Cordova Platform app.
      at node_modules/pwabuilder/node_modules/pwabuilder-lib/lib/projectBuilder.js:147:31
      at _rejected (node_modules/pwabuilder/node_modules/q/q.js:864:24)
      at node_modules/pwabuilder/node_modules/q/q.js:890:30
      at Promise.when (node_modules/pwabuilder/node_modules/q/q.js:1142:31)
      at Promise.promise.promiseDispatch (node_modules/pwabuilder/node_modules/q/q.js:808:41)
      at node_modules/pwabuilder/node_modules/q/q.js:624:44
      at runSingle (node_modules/pwabuilder/node_modules/q/q.js:137:13)
      at flush (node_modules/pwabuilder/node_modules/q/q.js:125:13)
      at _combinedTickCallback (internal/process/next_tick.js:131:7)
      at process._tickCallback (internal/process/next_tick.js:180:9)
  Failed to add the Cordova platforms: android.
      at node_modules/pwabuilder/node_modules/pwabuilder-cordova/lib/platform.js:76:23
      at _rejected (node_modules/pwabuilder/node_modules/q/q.js:864:24)
      at node_modules/pwabuilder/node_modules/q/q.js:890:30
      at Promise.when (node_modules/pwabuilder/node_modules/q/q.js:1142:31)
      at Promise.promise.promiseDispatch (node_modules/pwabuilder/node_modules/q/q.js:808:41)
      at node_modules/pwabuilder/node_modules/q/q.js:624:44
      at runSingle (node_modules/pwabuilder/node_modules/q/q.js:137:13)
      at flush (node_modules/pwabuilder/node_modules/q/q.js:125:13)
      at _combinedTickCallback (internal/process/next_tick.js:131:7)
      at process._tickCallback (internal/process/next_tick.js:180:9)
  External process [process ID: 11596] completed with errors. Error: Cannot read property 'toLowerCase' of undefined
      at ChildProcess.<anonymous> (node_modules/pwabuilder/node_modules/pwabuilder-lib/lib/processTools.js:109:17)
      at emitTwo (events.js:126:13)
      at ChildProcess.emit (events.js:214:7)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
boyofgreen commented 6 years ago

yea, I think this is because we are cleansing for the package name. Let me see if someone can look at this. Android only where you see this?

Dan-Q commented 6 years ago

Don't know; I can only promise it fails for Android because I only know for certain that Android works normally on this box. Sorry I'm not much use; this tool's way outside my normal wheelhouse.

lucaasrojas commented 5 years ago

@Dan-Q I reviewed the issue and I found that the problem was with Cordova, which was replaced with a native android implementation. I made a test and the name was set correctly. Could you try it out to confirm?

image