Crashin Angular project docker container

I have docker container for angular project, using node 18; Dockerfile: FROM node:18 WORKDIR /app COPY package*.json ./ RUN npm update RUN npm install COPY . . EXPOSE 4200 CMD ["ng", "serve", "–host", "0.0.0.0", "–port", "4200"] problem is when I run sudo docker-copmose build, its good but then i try sudo docker-compose up it has… Read More Crashin Angular project docker container

error 'MODULE NOT FOUND', Cannot find module

I am trying to resole the pathing issues: this is what my files structure look like: /www/html/ /database/ databaseConnection.js /scripts/ LoginPageScript.js server.js index.html in the database js file, the following code: const mysql = require(‘mysql2’); const pool = mysql.createPool({ connectionLimit: 10, host: process.env.DB_HOST, port: process.env.DB_PORT, user: process.env.DB_USER, password: process.env.DB_PASSWORD, database: process.env.DATABASE }); pool.getConnection((err, connection) =>… Read More error 'MODULE NOT FOUND', Cannot find module

Does importing only a single function also runs other functions in that file?

I have this code in the file bmiCalculator.ts import { isNotNumber } from "./utils"; export default function calculateBmi(height: number, weight: number) { const bmi = weight / Math.pow(height / 100, 2); if (bmi < 18.5) { return "Underweight"; } else if (bmi >= 18.5 && bmi < 25) { return "Normal (healthy weight)"; } else… Read More Does importing only a single function also runs other functions in that file?

NodeJS script split into multiple files – require vs. import problems

I have 2 files: |- main.js |- lib\ |- myLib.js I added a Node.js package (camelcase in this case) to the project using NPM: "dependencies": { "camelcase": "^7.0.1" } In myLib.js I need that the camelCase function coming from this package. The myLib script defines some utility functions used in main.js. First, I tried to… Read More NodeJS script split into multiple files – require vs. import problems

ReferenceError: require is not defined (at node:internal/main/run_main_module:23:47) in Node.js

I am learning Node.js (Node.js v18.12.1) and started building my first server (backend app). here is the code const express = requrie("express"); const app = express(); const port = 3000; app.get("/", function (req, res) { res.sendFile("index.html"); }); app.listen(port, function () { console.log("Server is running on 3000"); }); However, I am getting the following error when… Read More ReferenceError: require is not defined (at node:internal/main/run_main_module:23:47) in Node.js

type 'List<dynamic>' is not a subtype of type 'Map<String, Widget>'

‘class CarouselImages extends StatefulWidget { const CarouselImages({ Key? key, }) : super(key: key); @override State<CarouselImages> createState() => _CarouselImagesState(); } class _CarouselImagesState extends State<CarouselImages> { Advertise? advertises; final AdvertiseService advertiseService = AdvertiseService(); @override void initState() { super.initState(); fetchAdsOfDay(); } fetchAdsOfDay() async { advertises = (await advertiseService.fetchAdsOfDay(context: context)); setState(() {}); } @override Widget build(BuildContext context) { return… Read More type 'List<dynamic>' is not a subtype of type 'Map<String, Widget>'