NativeScript / nativescript-geolocation

Geolocation plugin to use for getting current location, monitor movement, etc
Apache License 2.0
139 stars 76 forks source link

`Unexpected token } in JSON` while tns plugin add nativescript-geolocation #212

Closed fabioaraujo121 closed 5 years ago

fabioaraujo121 commented 5 years ago

I'm at Nativescript-vue and I'm trying to install, just using: tns plugin add nativescript-geolocation

After I do that I got this answer:

npm ERR! Unexpected token } in JSON at position 348292 while parsing near '...ymyKxBk="
npm ERR!     }
npm ERR!   }
npm ERR! }
npm ERR! '

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fabio/.npm/_logs/2019-04-18T05_09_17_800Z-debug.log
Command npm failed with exit code 1

And the console says:

0 info it worked if it ends with ok
1 verbose cli [ '/home/fabio/.nvm/versions/node/v11.1.0/bin/node',
1 verbose cli   '/home/fabio/.nvm/versions/node/v11.1.0/bin/npm',
1 verbose cli   'install',
1 verbose cli   'nativescript-geolocation',
1 verbose cli   '--save' ]
2 info using npm@6.4.1
3 info using node@v11.1.0
4 verbose npm-session bdd950eeb64506fe
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/nativescript-geolocation 1680ms (from cache)
8 silly pacote tag manifest for nativescript-geolocation@latest fetched in 1776ms
9 timing stage:loadCurrentTree Completed in 11680ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 14ms
13 silly install loadShrinkwrap
14 timing stage:rollbackFailedOptional Completed in 1ms
15 timing stage:runTopLevelLifecycles Completed in 11748ms
16 ...
17 verbose stack SyntaxError: Unexpected token } in JSON at position 348292 while parsing near '...ymyKxBk="
17 verbose stack     }
17 verbose stack   }
17 verbose stack }
17 verbose stack '
17 verbose stack     at JSON.parse (<anonymous>)
17 verbose stack     at parseJson (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
17 verbose stack     at module.exports (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/lib/utils/parse-json.js:4:10)
17 verbose stack     at parsePkgLock (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/lib/install/read-shrinkwrap.js:68:12)
17 verbose stack     at BB.join (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/lib/install/read-shrinkwrap.js:28:22)
17 verbose stack     at tryCatcher (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
17 verbose stack     at Holder$3._callFunction (eval at generateHolderClass (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:14:44)
17 verbose stack     at Holder$3.checkFulfillment (eval at generateHolderClass (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:92:16), <anonymous>:29:30)
17 verbose stack     at Promise.eval (eval at thenCallback (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/join.js:14:16), <anonymous>:6:20)
17 verbose stack     at Promise._settlePromise (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:566:21)
17 verbose stack     at Promise._settlePromise0 (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
17 verbose stack     at Promise._settlePromises (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
17 verbose stack     at Promise._fulfill (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
17 verbose stack     at Promise._settlePromise (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:582:21)
17 verbose stack     at Promise._settlePromise0 (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
17 verbose stack     at Promise._settlePromises (/home/fabio/.nvm/versions/node/v11.1.0/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
18 verbose cwd /home/fabio/PMC/mobile/gaus
19 verbose Linux 4.15.0-43-generic
20 verbose argv "/home/fabio/.nvm/versions/node/v11.1.0/bin/node" "/home/fabio/.nvm/versions/node/v11.1.0/bin/npm" "install" "nativescript-geolocation" "--save"
21 verbose node v11.1.0
22 verbose npm  v6.4.1
23 error Unexpected token } in JSON at position 348292 while parsing near '...ymyKxBk="
23 error     }
23 error   }
23 error }
23 error '
24 verbose exit [ 1, true ]
tgpetrov commented 5 years ago

Hi @fabioaraujo121 I can't reproduce such issue. Here's what I did:

tns create my-blank-vue --template tns-template-blank-vue
cd my-blank-vue
tns plugin add nativescript-geolocation

and received a Successfully installed plugin nativescript-geolocation response. Let me know if I am missing something. Also, can you try to remove your package-lock.json file, before trying to add this plugin as it may also be related to this issue?

fabioaraujo121 commented 5 years ago

Hi @tgpetrov Remove the package-lock.json solved the problem.

Thanks for help! :D