Questions tagged [unexpected-token]
213 questions
16
votes
3 answers
Destructuring assignment cause error: "unexpected token ="
let's say I call use this syntax in es6:
let a, b;
{a, b} = { a: 100, b: 300 };
the code will run without error;
but let's rewrite is like this:
function fn() {
return { a: 100, b: 200 }
}
let a, b;
{ a, b } = fn();
when I run the code…

碳60
- 173
- 1
- 7
12
votes
3 answers
SyntaxError: Unexpected identifier jest & babel 7 & react-native 0.56
After upgrading react native version to 0.56, I could not run my tests.
I was testing my app before upgrade.
I get SyntaxError: Unexpected identifier error.
Details in below. Can you help me, please?
This is my devDependencies.
"@babel/core":…

asimolmez
- 700
- 8
- 14
11
votes
3 answers
reCAPTCHA Unexpected token in JSON at position 0
We use reCAPTCHA ver 2 as checkbox "I am not bot". Since from 2020-11-05 19:23:00Z during our page loading we get exception:
recaptcha__ru.js:211 Uncaught (in promise) SyntaxError: Unexpected token in JSON at position 0
at JSON.parse…

AnatolyS
- 4,249
- 18
- 28
9
votes
3 answers
How to fix Vite build / parser error "Unexpected token" in third party dependencies?
I'm trying to create a production build of my React application with Vite. When I run the npm run dev command, the app will start and seems to work as it should, but during the build I always get these kind of parser errors by some third party…

pingu
- 91
- 1
- 1
- 2
7
votes
4 answers
How to fix refreshing error with Echo and Angular
I'm setting up a web server with Go (using Echo) as the backend and Angular 6 as the frontend.
What I do is make a simple app using Angular-cli 'ng new my-app', add a helloworld component and a '/helloworld' route and then build it into production…

Tuan Nguyen
- 73
- 4
6
votes
3 answers
How to fix Vite build / syntax error "Unexpected token" in third party dependencies?
I'm trying to create a production build of my React application with Vite. When I run the npm run dev command, the app will start and seems to work as it should, but during the build I always get these kind of parser errors by some third party…

Watson T Matos
- 119
- 7
6
votes
3 answers
React Unexpected token < - babel loader
Hi i have problem with babel-loader it write me
ERROR in ./src/js/pages/Admin/views/Pages/Register/Register.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError:…

d3tr1tus
- 789
- 2
- 10
- 23
5
votes
2 answers
Jest error with not transpiled node module
When trying to run a test Jest throws the encountered unexpected token error. I'm using ky http, which obviously causes the problem and not get's transpiled.
Test suite failed to run
Jest encountered an unexpected token
This usually means…

DoeJoe
- 51
- 4
5
votes
1 answer
Uncaught SyntaxError: Unexpected token < in inline.bundle.js:1 - Angular v4
After deployment to IIS I found out that none of my routes work, Hence I researched then found this question in which says that you have to add a rewrite to web.config, which I did and routes are working now.
Here is some of my routes that work in…

Hooman L
- 151
- 2
- 8
4
votes
1 answer
New pipe operator |> gives 'unexpected token' flag in RStudio, although the code runs correctly
I want to use the new pipe operator |> in Rstudio, but when I use it in any fashion I get the unexpected token '>' flag. For example, writing
"hi" |> print()
gives me
The code, however, executes alright.
Why am I getting that error flag, why is…

Matteo
- 2,774
- 1
- 6
- 22
4
votes
2 answers
GitHub Pages - Unexpected Token '<' on Live, no issue on Local
I made a GitHub pages site using Vue some months back (URL: https://wintersen.github.io/) which worked fine. Today (5/7/21) I noticed that when I opened it, it displayed a blank page where my index was being loaded, but the console…

Erika Winters
- 43
- 4
4
votes
1 answer
Nx-NestJS-TypeOrm: SyntaxError: Unexpected token {
After hours of digging, I need your help !
The context
I'm currently creating(early stage) an application with the stack : Nx(monorepo) + NestJS + TypeOrm
Here is my ormconfig file :
"type": "postgres",
"host": "localhost",
"port":…

Nakama-dev
- 41
- 1
- 3
3
votes
1 answer
Failed to assign sh output to a variable when sh output contains opening bracket ( | Jenkins Declarative Pipeline
I am trying in one of the steps to write some data in file, and in step after that to read that data using and assign it to a variable. This is my declarative Jenkins pipeline:
pipeline {
agent {label 'build-slave-aws'}
stages {
…

Marko Јovičić
- 33
- 5
3
votes
1 answer
defaultRowRenderer breaks jest unit test. ...Object. ... import createMultiSort
When I use defaultRowRenderer (method of react-virtualized for Table), jest unit-tests are failed with error:…

Artem
- 31
- 1
2
votes
1 answer
React compiler end up with Unexpected token <
I am beginner in React and I am struggling with compiler error. Let me introduce my situation. I have two independent React applications:
App A - Big ERP
App B - "Plugin" to the App A
I supposed I will develop App B as an independent application.…

Lukas Hanincik
- 41
- 6