nativescript-cli: SyntaxError: Unexpected token < in JSON at position 0

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

from my package.json:

"dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "@nativescript/theme": "~2.3.0",
    "nativescript-angular": "~8.21.0",
    "nativescript-ui-sidedrawer": "~8.0.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "~6.5.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@nativescript/schematics": "^9.0.0",
    "@ngtools/webpack": "~8.2.0",
    "codelyzer": "~4.5.0",
    "nativescript-angular-cli": "^0.1.9",
    "nativescript-dev-webpack": "~1.5.0",
    "node-sass": "^4.7.1",
    "tslint": "~5.19.0",
    "typescript": "~3.5.3"
  },

Describe the bug Interesting issue- my project is working fine yesterday. today i run it and all of the sudden I start getting an error when connecting to my app with the nativescript playground previewer. 🤔

To Reproduce

by running tns preview

Expected behavior it should compile and work and be the beautiful former self that it was!  🙃

Sample project https://github.com/JimLynchCodes/Study-App/tree/master/study-app

Additional context any advice on why this is happening and what i should do is appreciated. thanks!

btw I have noticed that many times when testing on a physical ios device via tns preview the thing just crashes with no helpful error message in the console, no line number, etc.

here is the output i am seeing after using the playground to scan the barcode:

**Preparing project...
File change detected. Starting incremental webpack compilation...

webpack is watching the files…

Hash: cc19848af376aacf6e72
Version: webpack 4.27.1
Time: 4846ms
Built at: 08/13/2020 11:41:27 PM
                   Asset       Size   Chunks             Chunk Names
                    0.js   36.6 KiB        0  [emitted]  
                    1.js     36 KiB        1  [emitted]  
                    2.js   13.3 KiB        2  [emitted]  
                    3.js   15.7 KiB        3  [emitted]  
                    4.js   14.8 KiB        4  [emitted]  
                    5.js   11.6 KiB        5  [emitted]  
               bundle.js    506 KiB   bundle  [emitted]  bundle
 fonts/fa-brands-400.ttf    131 KiB           [emitted]  
fonts/fa-regular-400.ttf   39.1 KiB           [emitted]  
  fonts/fa-solid-900.ttf    204 KiB           [emitted]  
            package.json  112 bytes           [emitted]  
              runtime.js     73 KiB  runtime  [emitted]  runtime
               vendor.js   21.2 KiB   vendor  [emitted]  vendor
Entrypoint bundle = runtime.js vendor.js bundle.js
[../$$_lazy_route_resource lazy recursive] ../$$_lazy_route_resource lazy namespace object 160 bytes {bundle} [built]
[./app.scss] 121 KiB {bundle} [built]
[./app/app-routing.module.ts] 1.97 KiB {bundle} [built]
[./app/app.component.html] 2.29 KiB {bundle} [built]
[./app/app.component.ts] 1.99 KiB {bundle} [built]
[./app/app.module.ts] 3.51 KiB {bundle} [built]
[./app/data/question-bank.ts] 41.7 KiB {bundle} [built]
[./app/mock-exam/mock-exam.module.ts] 760 bytes {4} [built]
[./app/utils/question-generator/question-generator.service.ts] 3.26 KiB {bundle} [built]
[./main.ts] 1.57 KiB {bundle} [built]
[@angular/core] external "@angular/core" 42 bytes {bundle} [built]
[nativescript-angular/nativescript.module] external "nativescript-angular/nativescript.module" 42 bytes {bundle} [built]
[nativescript-angular/platform] external "nativescript-angular/platform" 42 bytes {bundle} [built]
[nativescript-ui-sidedrawer/angular] external "nativescript-ui-sidedrawer/angular" 42 bytes {bundle} [built]
[tns-core-modules/bundle-entry-points] external "tns-core-modules/bundle-entry-points" 42 bytes {bundle} [built]
    + 43 hidden modules
Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (ios)
Start sending initial files for device hadxain’s iPhone (4DA00FAE-D90B-4D76-8093-F5AB009E6B54).
Successfully sent initial files for device hadxain’s iPhone (4DA00FAE-D90B-4D76-8093-F5AB009E6B54).
SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at PreviewSdkService.<anonymous> (/Users/jlynch/.nvm/versions/node/v13.13.0/lib/node_modules/nativescript/lib/services/livesync/playground/preview-sdk-service.js:100:43)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jlynch/.nvm/versions/node/v13.13.0/lib/node_modules/nativescript/lib/services/livesync/playground/preview-sdk-service.js:4:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Like I was saying earlier, I have been working on this app for a few weeks now. Everything was fine even yesterday, commited everything to version control, and now today with no git changes I am getting this error. 🤔

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Yep, works again for me too. thanks!

Same here. Can also be reproduced with an absolutely new created project.

Sorry guy and gals, we were updating the Playground and apparently messed something up. We have reverted to the older version of the code base and will try and figure out why the new version breaks here, and hopefully some time next week we can deploy the newer version without this issue. 😀

Waiting for that today! 🤞🤞🤞🤞🤞🤞🤞 Btw, should we go back to an older version? Which version do you recommend?

@JimLynchCodes - This will not effect building / publishing. The only issue is the backend that the preview system used is being changed and so we are working on getting the issues fixed. This only affects Preview and the playground (Preview).

Exact same issue. Thought I was going crazy.