apihub icon indicating copy to clipboard operation
apihub copied to clipboard

Error on using docker installation

Open yokey1219 opened this issue 9 months ago • 6 comments

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?

yokey1219 avatar Apr 30 '24 04:04 yokey1219

I am also having this issue. What can I do to fix this issue?

mhdabdurahiman avatar May 01 '24 10:05 mhdabdurahiman

@yokey1219 Could you please try this with node version < 20?

wajeshubham avatar May 01 '24 17:05 wajeshubham

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.

mhdabdurahiman avatar May 01 '24 18:05 mhdabdurahiman

@wajeshubham can you please check my PR #150 for this issue.

gdhyani avatar May 03 '24 20:05 gdhyani

@yokey1219 Could you please try this with node version < 20?

@wajeshubham yes! It works

yokey1219 avatar May 06 '24 03:05 yokey1219

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.

@mhdabdurahiman Thanks for your suggestion!

yokey1219 avatar May 06 '24 03:05 yokey1219

Fixed in commit: https://github.com/hiteshchoudhary/apihub/commit/8c98e243b980c156a83e0165a62bad56e9c68bfb

wajeshubham avatar May 17 '24 18:05 wajeshubham