dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

Cannot install plugin in Ionic project #194

Closed lavenpillay closed 6 years ago

lavenpillay commented 6 years ago

I'm submitting a ... (check one with "x"):

Bug report

Cannot install plugin due to an "unknown domain" error

Current behavior:

When using this command :

ionic cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator

I'm getting this error response:

> cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator --save

You have been opted out of telemetry. To change this, run: cordova telemetry on.
(node:22924) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: npm: Command failed with exit code 1 Error output:
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! registry error parsing json
npm ERR! Unexpected token < in JSON at position 0
npm ERR! <html>
npm ERR! <head>
npm ERR! <title>Fastly error: unknown domain</title>
npm ERR! </head>
npm ERR! <body>
npm ERR! Fastly error: unknown domain. Please check that this domain has been added to a service.
npm ERR! </body>
npm ERR! </html>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/laven/.npm/_logs/2018-05-30T10_56_42_687Z-debug.log
(node:22924) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Output from debug log :

0 info it worked if it ends with ok
1 verbose cli [ '/home/laven/.nvm/versions/node/v8.9.1/bin/node',
1 verbose cli   '/home/laven/.nvm/versions/node/v8.9.1/bin/npm',
1 verbose cli   'view',
1 verbose cli   'uk.co.workingedge.phonegap.plugin.launchnavigator',
1 verbose cli   '--json' ]
2 info using npm@5.5.1
3 info using node@v8.9.1
4 silly mapToRegistry name uk.co.workingedge.phonegap.plugin.launchnavigator
5 silly mapToRegistry using default registry
6 silly mapToRegistry registry http://registry.npmjs.org/
7 silly mapToRegistry data { type: 'tag',
7 silly mapToRegistry   registry: true,
7 silly mapToRegistry   where: undefined,
7 silly mapToRegistry   raw: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
7 silly mapToRegistry   name: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
7 silly mapToRegistry   escapedName: 'uk.co.workingedge.phonegap.plugin.launchnavigator',
7 silly mapToRegistry   scope: undefined,
7 silly mapToRegistry   rawSpec: '',
7 silly mapToRegistry   saveSpec: null,
7 silly mapToRegistry   fetchSpec: 'latest',
7 silly mapToRegistry   gitRange: undefined,
7 silly mapToRegistry   gitCommittish: undefined,
7 silly mapToRegistry   hosted: undefined }
8 silly mapToRegistry uri http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
9 verbose request uri http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
10 verbose request no auth needed
11 info attempt registry request try #1 at 12:55:31
12 verbose request id f68b82510a0eb8fa
13 http request GET http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
14 http 500 http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
15 verbose bad json <html>
15 verbose bad json <head>
15 verbose bad json <title>Fastly error: unknown domain</title>
15 verbose bad json </head>
15 verbose bad json <body>
15 verbose bad json Fastly error: unknown domain. Please check that this domain has been added to a service.
15 verbose bad json </body>
15 verbose bad json </html>
16 error registry error parsing json
17 verbose headers { server: 'Varnish',
17 verbose headers   'retry-after': '0',
17 verbose headers   'content-type': 'text/html',
17 verbose headers   'content-length': '177',
17 verbose headers   'accept-ranges': 'bytes',
17 verbose headers   date: 'Wed, 30 May 2018 10:55:31 GMT',
17 verbose headers   via: '1.1 varnish',
17 verbose headers   connection: 'close',
17 verbose headers   'x-served-by': 'cache-ams4151-AMS',
17 verbose headers   'x-cache': 'MISS',
17 verbose headers   'x-cache-hits': '0',
17 verbose headers   'x-timer': 'S1527677732.590149,VS0,VE0' }
18 info retry will retry, error on last attempt: SyntaxError: Unexpected token < in JSON at position 0
18 info retry <html>
18 info retry <head>
18 info retry <title>Fastly error: unknown domain</title>
18 info retry </head>
18 info retry <body>
18 info retry Fastly error: unknown domain. Please check that this domain has been added to a service.
18 info retry </body>
18 info retry </html>
19 info attempt registry request try #2 at 12:55:41
20 http request GET http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
21 http 500 http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
22 verbose bad json <html>
22 verbose bad json <head>
22 verbose bad json <title>Fastly error: unknown domain</title>
22 verbose bad json </head>
22 verbose bad json <body>
22 verbose bad json Fastly error: unknown domain. Please check that this domain has been added to a service.
22 verbose bad json </body>
22 verbose bad json </html>
23 error registry error parsing json
24 verbose headers { server: 'Varnish',
24 verbose headers   'retry-after': '0',
24 verbose headers   'content-type': 'text/html',
24 verbose headers   'content-length': '177',
24 verbose headers   'accept-ranges': 'bytes',
24 verbose headers   date: 'Wed, 30 May 2018 10:55:41 GMT',
24 verbose headers   via: '1.1 varnish',
24 verbose headers   connection: 'close',
24 verbose headers   'x-served-by': 'cache-ams4424-AMS',
24 verbose headers   'x-cache': 'MISS',
24 verbose headers   'x-cache-hits': '0',
24 verbose headers   'x-timer': 'S1527677742.986084,VS0,VE0' }
25 info retry will retry, error on last attempt: SyntaxError: Unexpected token < in JSON at position 0
25 info retry <html>
25 info retry <head>
25 info retry <title>Fastly error: unknown domain</title>
25 info retry </head>
25 info retry <body>
25 info retry Fastly error: unknown domain. Please check that this domain has been added to a service.
25 info retry </body>
25 info retry </html>
26 info attempt registry request try #3 at 12:56:42
27 http request GET http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
28 http 500 http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
29 verbose bad json <html>
29 verbose bad json <head>
29 verbose bad json <title>Fastly error: unknown domain</title>
29 verbose bad json </head>
29 verbose bad json <body>
29 verbose bad json Fastly error: unknown domain. Please check that this domain has been added to a service.
29 verbose bad json </body>
29 verbose bad json </html>
30 error registry error parsing json
31 verbose headers { server: 'Varnish',
31 verbose headers   'retry-after': '0',
31 verbose headers   'content-type': 'text/html',
31 verbose headers   'content-length': '177',
31 verbose headers   'accept-ranges': 'bytes',
31 verbose headers   date: 'Wed, 30 May 2018 10:56:42 GMT',
31 verbose headers   via: '1.1 varnish',
31 verbose headers   connection: 'close',
31 verbose headers   'x-served-by': 'cache-ams4429-AMS',
31 verbose headers   'x-cache': 'MISS',
31 verbose headers   'x-cache-hits': '0',
31 verbose headers   'x-timer': 'S1527677803.527545,VS0,VE0' }
32 verbose stack SyntaxError: Unexpected token < in JSON at position 0
32 verbose stack <html>
32 verbose stack <head>
32 verbose stack <title>Fastly error: unknown domain</title>
32 verbose stack </head>
32 verbose stack <body>
32 verbose stack Fastly error: unknown domain. Please check that this domain has been added to a service.
32 verbose stack </body>
32 verbose stack </html>
32 verbose stack     at JSON.parse (<anonymous>)
32 verbose stack     at RegClient.<anonymous> (/home/laven/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:243:23)
32 verbose stack     at Request._callback (/home/laven/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:216:14)
32 verbose stack     at Request.self.callback (/home/laven/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/request/request.js:186:22)
32 verbose stack     at emitTwo (events.js:126:13)
32 verbose stack     at Request.emit (events.js:214:7)
32 verbose stack     at Request.<anonymous> (/home/laven/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/request/request.js:1163:10)
32 verbose stack     at emitOne (events.js:116:13)
32 verbose stack     at Request.emit (events.js:211:7)
32 verbose stack     at IncomingMessage.<anonymous> (/home/laven/.nvm/versions/node/v8.9.1/lib/node_modules/npm/node_modules/request/request.js:1085:12)
33 verbose cwd /home/laven/Development/efekto-app-new
34 verbose Linux 4.13.0-39-generic
35 verbose argv "/home/laven/.nvm/versions/node/v8.9.1/bin/node" "/home/laven/.nvm/versions/node/v8.9.1/bin/npm" "view" "uk.co.workingedge.phonegap.plugin.launchnavigator" "--json"
36 verbose node v8.9.1
37 verbose npm  v5.5.1
38 error Unexpected token < in JSON at position 0
38 error <html>
38 error <head>
38 error <title>Fastly error: unknown domain</title>
38 error </head>
38 error <body>
38 error Fastly error: unknown domain. Please check that this domain has been added to a service.
38 error </body>
38 error </html>
39 verbose exit [ 1, true ]

Expected behavior:

Should install from NPM repo

Steps to reproduce:

Run this command in a cordova project :

ionic cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator

dpa99c commented 6 years ago

Installing from npm works fine for me (see console output below).

Looking at the error message in your log, it looks like npm is receiving a webpage response instead of JSON:

<title>Fastly error: unknown domain</title>

Check your internet connection is working properly.

Closing as it is not a problem caused by this plugin.

console output ``` $ ionic cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator > cordova plugin add uk.co.workingedge.phonegap.plugin.launchnavigator --save Installing "uk.co.workingedge.phonegap.plugin.launchnavigator" for android Plugin dependency "cordova-plugin-actionsheet@2.3.3" already fetched, using that version. Installing "cordova-plugin-actionsheet" for android ANDROID_HOME=G:\Users\dpa99\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161 Subproject Path: CordovaLib Download https://repo1.maven.org/maven2/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.pom Download https://repo1.maven.org/maven2/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.pom Download https://repo1.maven.org/maven2/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar Download https://repo1.maven.org/maven2/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0. The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead. :clean :CordovaLib:clean BUILD SUCCESSFUL Total time: 17.578 secs Picked up _JAVA_OPTIONS: -Xms256m -Xmx4096m Plugin dependency "cordova-plugin-dialogs@1.3.3" already fetched, using that version. Installing "cordova-plugin-dialogs" for android Subproject Path: CordovaLib Installing "uk.co.workingedge.phonegap.plugin.launchnavigator" for ios Plugin dependency "cordova-plugin-actionsheet@2.3.3" already fetched, using that version. Installing "cordova-plugin-actionsheet" for ios Plugin dependency "cordova-plugin-dialogs@1.3.3" already fetched, using that version. Installing "cordova-plugin-dialogs" for ios Adding uk.co.workingedge.phonegap.plugin.launchnavigator to package.json Saved plugin info for "uk.co.workingedge.phonegap.plugin.launchnavigator" to config.xml ```
lavenpillay commented 6 years ago

Thanks for checking. If you have time, to help me investigate my issue, please send me your full detailed npm log for that. Specifically i'm looking for this section (near the top), since I have a working internet connection, but maybe its our company web-filter or something.

Thanks

8 silly mapToRegistry uri http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
9 verbose request uri http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
10 verbose request no auth needed
11 info attempt registry request try #1 at 12:55:31
12 verbose request id f68b82510a0eb8fa
13 http request GET http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
14 http 500 http://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator
dpa99c commented 6 years ago

Since you asked nicely :grin:

console output ``` $ npm install uk.co.workingedge.phonegap.plugin.launchnavigator --verbose --debug npm info it worked if it ends with ok npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe', npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', npm verb cli 'install', npm verb cli 'uk.co.workingedge.phonegap.plugin.launchnavigator', npm verb cli '--verbose', npm verb cli '--debug' ] npm info using npm@5.6.0 npm info using node@v8.11.1 npm verb npm-session b77674b78b5ca3cf npm http fetch GET 200 https://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator 247ms npm verb correctMkdir G:\Users\dpa99\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing npm verb lock using G:\Users\dpa99\AppData\Roaming\npm-cache\_locks\staging-09f2f03b27155e3f.lock for D:\Git\phonegap-launch-navigator-example\Ionic3Example\node_modules\.staging npm info lifecycle uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0~preinstall: uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0 npm info linkStuff uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0 npm verb linkBins uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0 npm verb linkMans uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0 npm info lifecycle uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0~install: uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0 npm info lifecycle uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0~postinstall: uk.co.workingedge.phonegap.plugin.launchnavigator@4.2.0 npm verb unlock done using G:\Users\dpa99\AppData\Roaming\npm-cache\_locks\staging-09f2f03b27155e3f.lock for D:\Git\phonegap-launch-navigator-example\Ionic3Example\node_modules\.staging npm verb saving [ { name: 'uk.co.workingedge.phonegap.plugin.launchnavigator', npm verb saving spec: '^4.2.0', npm verb saving save: 'dependencies' } ] npm info lifecycle undefined~preshrinkwrap: undefined npm info lifecycle undefined~shrinkwrap: undefined npm info lifecycle undefined~postshrinkwrap: undefined ```
lavenpillay commented 6 years ago

Excellent ! That helped confirm something which led me to the solution! For anyone else, who might've done the same:

The reason I was getting the error was because a few months ago, to fix a different NPM Registry issue, I added these lines to my hosts file, and I just had to remove them :

# npm fix
151.101.36.162 registry.npmjs.com
151.101.36.162 registry.npmjs.org

Thanks again, @dpa99c !!