Skip to content

Docker error SyntaxError: Unexpected token ; (and my suggested fix) #629

@westrany

Description

@westrany

Describe the bug

I wanted to use your template to create my own portofolio.

Upon trying to run the docker image, I kept getting a "docker error SyntaxError: Unexpected token ;" which I tried fixing by reviewing error message, checking for syntax issues and dependencies version compatability issues, updating npm and other dependencies, uninstalling and reinstalling npm, troubleshooting the docker image build, and reinstalling node.js and npm.

I'm not sure if the issue at hand was caused by something else on my computer, or if it has to do wish some dependency update that's causing this even though all dependencies seem compatible.

Steps to reproduce

In my case:

  1. Clone this repository.
  2. Build docker image.
  3. Run docker image - that's where I'd get the syntax error.

Again, unsure if this was due to something else going on on my computer, or if this was due to compatability issues.

Expected behavior

  1. Docker iamge would exit immediatly.
  2. Image wouldn't build.
  3. I'd get a "Docker error SyntaxError: Unexpected token ;" as shown bellow:
2023-08-21 05:18:36 
2023-08-21 05:18:36 > [email protected] start /app
2023-08-21 05:18:36 > node fetch.js && react-scripts start
2023-08-21 05:18:36 
2023-08-21 05:18:36 /app/node_modules/eslint-webpack-plugin/node_modules/jest-worker/build/index.js:110
2023-08-21 05:18:36   _ending;
2023-08-21 05:18:36          ^
2023-08-21 05:18:36 
2023-08-21 05:18:36 SyntaxError: Unexpected token ;
2023-08-21 05:18:36     at Module._compile (internal/modules/cjs/loader.js:721:23)
2023-08-21 05:18:36     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2023-08-21 05:18:36     at Module.load (internal/modules/cjs/loader.js:653:32)
2023-08-21 05:18:36     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
2023-08-21 05:18:36     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
2023-08-21 05:18:36     at Module.require (internal/modules/cjs/loader.js:690:17)
2023-08-21 05:18:36     at require (internal/modules/cjs/helpers.js:25:18)
2023-08-21 05:18:36     at Object.<anonymous> (/app/node_modules/eslint-webpack-plugin/dist/getESLint.js:9:5)
2023-08-21 05:18:36     at Module._compile (internal/modules/cjs/loader.js:776:30)
2023-08-21 05:18:36     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
2023-08-21 05:18:36 npm ERR! code ELIFECYCLE
2023-08-21 05:18:36 npm ERR! errno 1
2023-08-21 05:18:36 npm ERR! [email protected] start: `node fetch.js && react-scripts start`
2023-08-21 05:18:36 npm ERR! Exit status 1
2023-08-21 05:18:36 npm ERR! 
2023-08-21 05:18:36 npm ERR! Failed at the [email protected] start script.
2023-08-21 05:18:36 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2023-08-21 05:18:36 
2023-08-21 05:18:36 npm ERR! A complete log of this run can be found in:
2023-08-21 05:18:36 npm ERR!     /root/.npm/_logs/2023-08-21T04_18_36_896Z-debug.log 

Is this responsiveness Issue

NO

Screenshots

No response

Desktop

  • OS: Windows 11
  • Browser: OperaGX, Microsoft Edge, Brave

Smartphones

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

After trying a bunch of different things, I managed to get the image running by modifying lines 4 and 14 of the "Dockerfile" (in the root of the repository).

Modified line 4:
FROM node:14-alpine

Modified line 14:
RUN apk update && apk add --no-cache git

I'm unsure if this will only work for me or if this could be suggested as a possible fix. Thought I'd share this just in case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions