Azure/Stormspotter

[frontend] - SyntaxError: Unexpected reserved word - on docker

giupo opened this issue · 2 comments

giupo commented

on the following system:

  • Linux kali 6.0.0-kali6-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.0.12-1kali1 (2022-12-19) x86_64 GNU/Linux
  • Docker version 23.0.1, build a5ee5b1
  • Docker Compose version v2.16.0

Cloning the repository and typing

docker compose up 

Produces the following output:

[+] Running 3/3
 ⠿ Container stormspotter-stormspotter-neo4j-1     Recreated                                                                                   1.0s
 ⠿ Container stormspotter-stormspotter-backend-1   Recreated                                                                                   1.4s 
 ⠿ Container stormspotter-stormspotter-frontend-1  Recreated                                                                                   1.3s 
Attaching to stormspotter-stormspotter-backend-1, stormspotter-stormspotter-frontend-1, stormspotter-stormspotter-neo4j-1                           
stormspotter-stormspotter-frontend-1  | file:///usr/local/lib/node_modules/@quasar/cli/bin/quasar.js:43
stormspotter-stormspotter-frontend-1  |   const { getProjectRoot } = await import('../lib/get-project-root.js')
stormspotter-stormspotter-frontend-1  |                              ^^^^^
stormspotter-stormspotter-frontend-1  | 
stormspotter-stormspotter-frontend-1  | SyntaxError: Unexpected reserved word
stormspotter-stormspotter-frontend-1  |     at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
stormspotter-stormspotter-frontend-1  |     at async link (internal/modules/esm/module_job.js:42:21)
stormspotter-stormspotter-backend-1   | INFO:     Started server process [1]
stormspotter-stormspotter-backend-1   | INFO:     Waiting for application startup.
stormspotter-stormspotter-backend-1   | INFO:     Application startup complete.
stormspotter-stormspotter-backend-1   | INFO:     Uvicorn running on http://0.0.0.0:9090 (Press CTRL+C to quit)
stormspotter-stormspotter-frontend-1 exited with code 1

A quick fix would be to pin NodeJS to an higher version than 12 in frontend/dockerfile (I know this is quite "generic", but even pinning to latest fixed the issue)

I confirm the bug AND the proposed solution.
Thanks @giupo

For those of you who don't speak simple docker like myself - to break down guipo's fix:

  1. in your /Stormspotter/frondend/dockerfile file modify the first line to become From node:latest
  2. Save the changes
  3. Rebuild the docker container with docker-compose up --build
  4. The frontend should now be working and accessible at http://localhost:90901

Thanks @giupo