So I’m new with docker and I’m running a very simple react app just so I can test my grounds and learn the fundamentals. BUT I’ve been stuck on this error for 2 days now.
My docker container exits after run immediately with a syntax error in index.js
Here is an overview :
- *I used create react app and simply added some components
- *Built a docker file this way (this is only the first step of the tutorial I’m following)
FROM node:15
WORKDIR /app
COPY package.json .
RUN npm install npm
COPY ./src ./
EXPOSE 3000
CMD [“node”, “index.js”]
-
*I run my image with this command docker build -t node-app-image .
-
*I run my container with this command docker run -d -p 3000:3000 --name node-app node-app-image
*This is my package.json :
-
THIS IS THE error with docker logs :
file:///app/index.js:9
<React.StrictMode>
^
SyntaxError: Unexpected token ‘<’
at Loader.moduleStrategy (node:internal/modules/esm/translators:147:18)
at async link (node:internal/modules/esm/module_job:48:21) -
*PS: I’m using ubuntu 20.4