Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run the projet at first start #249

Open
JosefRDA opened this issue Oct 27, 2024 · 3 comments
Open

Unable to run the projet at first start #249

JosefRDA opened this issue Oct 27, 2024 · 3 comments
Assignees
Labels
🐞 Bug Something isn't working

Comments

@JosefRDA
Copy link

JosefRDA commented Oct 27, 2024

Describe the Bug (버그 설명)

I have tried to clone and use this project according to readme.md instructions but I consistently get a “[nodemon] app crashed - waiting for file changes before starting...” error on startup whether via npm or via docker-compose.

Version to Reproduce (현재 사용한 버전)

Latest github master version ( v10.2.1 ?)
Node v21.7.1

Steps to Reproduce (재현 순서)

  • npm install -g typescript-express-starter
  • npx typescript-express-starter "my-new-project"
  • cd my-new-project

and then :

  • npm run dev

or :

  • docker-compose up

Expected Behavior (예상 동작)

The project startup and serve

Actual Behavior (실제 동작)

Console :

> [email protected] dev
> cross-env NODE_ENV=development nodemon

[nodemon] 2.0.22
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/* .env
[nodemon] watching extensions: js,ts,json
[nodemon] starting `ts-node -r tsconfig-paths/register --transpile-only src/server.ts`
[nodemon] app crashed - waiting for file changes before starting...

/src/logs/error/2024-10-27.log

2024-10-27 13:48:53 error: uncaughtException: Cannot find module '@exceptions/httpException'
Require stack:
- /home/vagrant/perso/dev/org/src/my-new-project/src/services/auth.service.ts
- /home/vagrant/perso/dev/org/src/my-new-project/src/controllers/auth.controller.ts
- /home/vagrant/perso/dev/org/src/my-new-project/src/routes/auth.route.ts
- /home/vagrant/perso/dev/org/src/my-new-project/src/server.ts
Error: Cannot find module '@exceptions/httpException'
Require stack:
- /home/vagrant/perso/dev/org/src/my-new-project/src/services/auth.service.ts
- /home/vagrant/perso/dev/org/src/my-new-project/src/controllers/auth.controller.ts
- /home/vagrant/perso/dev/org/src/my-new-project/src/routes/auth.route.ts
- /home/vagrant/perso/dev/org/src/my-new-project/src/server.ts
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1142:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (/home/vagrant/perso/dev/org/src/my-new-project/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._resolveFilename (/home/vagrant/perso/dev/org/src/my-new-project/node_modules/tsconfig-paths/src/register.ts:115:36)
    at Function.Module._load (node:internal/modules/cjs/loader:983:27)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/home/vagrant/perso/dev/org/src/my-new-project/src/services/auth.service.ts:5:1)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module.m._compile (/home/vagrant/perso/dev/org/src/my-new-project/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)
@JosefRDA JosefRDA added the 🐞 Bug Something isn't working label Oct 27, 2024
@vkotlyar3
Copy link

the same for me

@kanodaisuki
Copy link

我同样遇到了这个问题,在windows上,程序工作良好,但是当我将程序部署到ubuntu或者打包成docker镜像时,会遇到[nodemon] app crashed - waiting for file changes before starting...的错误,并没有详细的错误抛出来,这是灾难性的。

为了了解这个问题,我使用vscode对Ubuntu进行远程开发调试,通过捕获错误定位到了问题:

{624D3FE4-387F-4300-8BB4-0AC1270E50EC}

发生异常: Error: Cannot find module '@exceptions/httpException'
Require stack:
- /home/kanochan/cfws/catenary-frozen-warning-systems-server/src/middlewares/auth.middleware.ts
- /home/kanochan/cfws/catenary-frozen-warning-systems-server/src/routes/auth.route.ts
- /home/kanochan/cfws/catenary-frozen-warning-systems-server/src/server.ts
  at Function.<anonymous> (node:internal/modules/cjs/loader:1249:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue (/home/kanochan/cfws/catenary-frozen-warning-systems-server/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._resolveFilename (/home/kanochan/cfws/catenary-frozen-warning-systems-server/node_modules/tsconfig-paths/src/register.ts:115:36)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:141:16)
    at Object.<anonymous> (/home/kanochan/cfws/catenary-frozen-warning-systems-server/src/middlewares/auth.middleware.ts:5:1)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)

我意识到,这个一个很简单的问题:Windows对大小写是不敏感的,所以在Windows上开发时,一切正常;而Linux系统对大小写是敏感的,这样的导入无法正常工作。

解决办法

将所有关于

import { HttpException } from '@/exceptions/httpException';

的导入更改成

import { HttpException } from '@/exceptions/HttpException';

即可。

经过测试,程序能够正常运行。

@sharmaraju352
Copy link

Yes there's a typo while importing the module, it should've been HttpException not httpException

Also logs by default are getting stored inside src folder which is not right. Update below in logger.ts

// logs dir
const logDir: string = LOG_DIR;

and in .env.development.local
LOG_DIR = logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants