I learn about node-js and Docker. Since the beginning of this journey, I have developed incrementally this library. I can:
- Write a NodeJS app;
- Extend it to an express web app;
- Write a docker-compose.yml;
- Write a DockerFile;
So far, so good. Since we want to production-publish it, we run the command docker build -t IMAGE_NAME . && docker-compose up. The following error pops out:
Starting nodejs ... done
Attaching to nodejs
nodejs | [nodemon] 2.0.15
nodejs | [nodemon] to restart at any time, enter `rs`
nodejs | [nodemon] watching path(s): *.*
nodejs | [nodemon] watching extensions: js,mjs,json
nodejs | [nodemon] starting `node app.js ./src/index.js`
nodejs | /home/node/app/src/index.js:2
nodejs | import express from 'express';
nodejs | ^^^^^^^
nodejs |
nodejs | SyntaxError: Unexpected identifier
nodejs | at Module._compile (internal/modules/cjs/loader.js:723:23)
nodejs | at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
nodejs | at Module.load (internal/modules/cjs/loader.js:653:32)
nodejs | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
nodejs | at Function.Module._load (internal/modules/cjs/loader.js:585:3)
nodejs | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
nodejs | at startup (internal/bootstrap/node.js:283:19)
nodejs | at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
It seems a silly mistake I make, but at this point, I am still very novice to notice it. I thank you in advance for any help.