apihub
apihub copied to clipboard
Error on using docker installation
I meet an error when i followed the suggestion for using docker installation.The key log info as bellow:
"
backend-1 | > nodemon -r dotenv/config --experimental-json-modules src/index.js
backend-1 |
backend-1 | [nodemon] 2.0.22
backend-1 | [nodemon] to restart at any time, enter rs
backend-1 | [nodemon] watching path(s): .
backend-1 | [nodemon] watching extensions: js,mjs,html,css,coffee,litcoffee,json,yaml
backend-1 | [nodemon] starting node -r dotenv/config --experimental-json-modules src/index.js
backend-1 | file:///usr/src/freeapi/src/controllers/public/meal.controllers.js:1
backend-1 | import mealsJson from "../../json/meals.json" assert { type: "json" };
backend-1 | ^^^^^^
backend-1 |
backend-1 | SyntaxError: Unexpected identifier 'assert'
backend-1 | at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
backend-1 | at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
backend-1 | at callTranslator (node:internal/modules/esm/loader:416:14)
backend-1 | at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:422:30)
backend-1 |
backend-1 | Node.js v22.0.0
backend-1 | [nodemon] app crashed - waiting for file changes before starting...
"
What can i do now?
I am also having this issue. What can I do to fix this issue?
@yokey1219 Could you please try this with node version < 20?
I have used node version 18, and now it is working fine. For any of you guys not know how to change the node version, open the dockerfile in the root folder in the directory and change the first line, which is FROM node
to FROM node:18
. This will make sure the docker to install node version 18 instead of the latest version of node. Then use docker compose to build and run the container.
@wajeshubham can you please check my PR #150 for this issue.
@yokey1219 Could you please try this with node version < 20?
@wajeshubham yes! It works
I have used node version 18, and now it is working fine. For any of you guys not know how to change the node version, open the dockerfile in the root folder in the directory and change the first line, which is
FROM node
toFROM node:18
. This will make sure the docker to install node version 18 instead of the latest version of node. Then use docker compose to build and run the container.
@mhdabdurahiman Thanks for your suggestion!
Fixed in commit: https://github.com/hiteshchoudhary/apihub/commit/8c98e243b980c156a83e0165a62bad56e9c68bfb