Nuxt build on production failed: SyntaxError: Invalid or unexpected token

Boris Kamp

Im breaking my head over this, i've been searching for hours and trying everything, from downgrading nuxt to tracking back in my older commits to see what changed.

I get the following build error on AWS codebuild:

> nuxt build
--
165 |  
166 | /application/dotoo-web/node_modules/@nuxt/utils/node_modules/consola/dist/shared/consola.4bbae468.cjs:473
167 | if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {
168 | ^^^
169 |  
170 | SyntaxError: Invalid or unexpected token
171 | at Module._compile (internal/modules/cjs/loader.js:723:23)
172 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
173 | at Module.load (internal/modules/cjs/loader.js:653:32)
174 | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
175 | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
176 | at Module.require (internal/modules/cjs/loader.js:692:17)
177 | at require (internal/modules/cjs/helpers.js:25:18)
178 | at Object.<anonymous> (/application/dotoo-web/node_modules/@nuxt/utils/node_modules/consola/dist/index.cjs:5:15)
179 | at Module._compile (internal/modules/cjs/loader.js:778:30)
180 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
181 | npm ERR! code ELIFECYCLE
182 | npm ERR! errno 1
183 | npm ERR! [email protected] build: `nuxt build`
184 | npm ERR! Exit status 1

Im using Nuxt 2.17.0 and i'm pushing to a aws codebuild pipeline that was build by a third party for us. It seems it's still on Node 10 according to this line in the build log: Status: Downloaded newer image for node:10-alpine

Does anybody have a clue?

Vlad Holubiev

The error message refers to the use of a numeric separator in Node.js, which is not supported in Node versions prior to 12.8.1.

167 | if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {

0x3_00 here uses a numeric separator _. Without it, the notation would look like 0x300.

See https://node.green/#ES2021-features--numeric-separators for the list of Node.js versions that support this feature.

So looks like you need to upgrade node:10-alpine to at least node:12-alpine or better node:14-alpine if 12th doesn't work.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

ReactJS Module build failed: SyntaxError: Unexpected token - ReactDOM.render

Uncaught SyntaxError: Invalid or unexpected token

Uncaught SyntaxError: Invalid or unexpected token spring boot

jquery Uncaught SyntaxError: Invalid or unexpected token - Input text has an apostrophe

Uncaught SyntaxError: Invalid or unexpected token for new line

JQuery: Uncaught SyntaxError: Invalid or unexpected token

SyntaxError: Invalid or unexpected token @import

Html-Webpack-Plugin Template: Module build failed: SyntaxError: Unexpected token

SyntaxError: Unexpected token export when using lodash with Nuxt

Uncaught SyntaxError: Invalid or unexpected token @import css

Module build failed: SyntaxError: Unexpected token

node.js SyntaxError: Invalid or unexpected token

"npm run build" fails with SyntaxError:Unexpected token

Uncaught SyntaxError: Invalid or unexpected token in Html button

Laravel 5 Uncaught SyntaxError: Invalid or unexpected token (red dots)

Module build failed: SyntaxError: Unexpected token (11:16)

Uncaught SyntaxError: Invalid or unexpected token even with correct syntax

angular-cli: "SyntaxError: Unexpected token" when compiling for production and AOT

react-router-redux: Module build failed: SyntaxError: Unexpected token ...reducers

JQuery append() in Rails view gives "Uncaught SyntaxError: Invalid or unexpected token"

ReactJS - Module build failed: SyntaxError: Unexpected token react components not rendering

Module build failed: SyntaxError: Unexpected token, expected ,

Vue-Router error: "Module build failed: SyntaxError: Unexpected token"

Uncaught SyntaxError: Invalid or unexpected token in EXT JS

ScriptResource.axd Uncaught SyntaxError: Invalid or unexpected token

jquery Uncaught SyntaxError: Invalid or unexpected token - Error

Firebase: Uncaught SyntaxError: Invalid or unexpected token -> uncaught referenceError

TypeORM @Entity SyntaxError: Invalid or unexpected token

Nuxt Fatal Error SyntaxError: Invalid or unexpected token