Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
westrany opened this issue Aug 21, 2023 · 6 comments · May be fixed by #636
Open

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

westrany opened this issue Aug 21, 2023 · 6 comments · May be fixed by #636
Labels
bug Something isn't working

Comments

@westrany
Copy link

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 > developerfolio@0.1.0 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! developerfolio@0.1.0 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 developerfolio@0.1.0 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.

@westrany westrany added the bug Something isn't working label Aug 21, 2023
@nabeelnoor
Copy link

Step1: Could you remove the package-lock.json file and then try? The problem is you have the latest node version and that package-lock.json file is built using the older node version.
Step2: try the version node:14

  • Also there are some known issues related to docker which I am fixing.

@nabeelnoor
Copy link

Here is the pull request you can use for reference:-
#628

@westrany
Copy link
Author

I'll give that a try and I'll let you know it it works.

@westrany
Copy link
Author

westrany commented Aug 21, 2023

After deleting package-lock.json and using note:14, i'm now getting this error when running Docker Build:

image

@westrany
Copy link
Author

Got both docker build and image build working by changing line 14 in "Dockerfile" to RUN apk update && apk add --no-cache git.

Dunno why this is the only thing working for me, migth be due to something else I've installed?

Thanks for your help though!

@nabeelnoor
Copy link

nabeelnoor commented Aug 21, 2023

sorry for the delay, in the attached pull request, I have updated the docker file, kindly use that docker file and nginx.conf file for your work, but its fine, if things work for you.

nabeelnoor added a commit to nabeelnoor/developerFolio that referenced this issue Aug 30, 2023
@nabeelnoor nabeelnoor linked a pull request Aug 30, 2023 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants