nestjs / nest-cli

CLI tool for Nest applications 🍹
https://nestjs.com
Other
1.97k stars 394 forks source link

linux build Error #497

Closed LLLLLamHo closed 4 years ago

LLLLLamHo commented 4 years ago

Bug Report

Current behavior

I am running nest build command in centos of Linux system, but I Cannot find module image But I run it on my MAC and it compiles。

"@nestjs/common": "6.7.2", "@nestjs/core": "6.7.2", "@nestjs/cli": "6.9.0",

Expected behavior

Can compile normally under Linux

Environment


Nest version: 6.7.2

For Tooling issues:
- Node version: v8.14.0
- Platform:  Linux            
kamilmysliwiec commented 4 years ago

You have different versions of the @nestjs/cli installed globally. Ensure to update them to the latest versions.

LLLLLamHo commented 4 years ago

The same problem occurred when I upgraded the cli to 6.12.9

kamilmysliwiec commented 4 years ago

Please, provide a minimal repository which reproduces your issue.

cdash04 commented 4 years ago

I have the same problem, but it's building just fine on my computer but not in my GitHub actions workflow which is a linux machine.

Capture d’écran, le 2020-01-17 à 20 18 52

Only some classes from my domain aren't found.

Here is my package.json

"dependencies": { "@nestjs/common": "^6.7.2", "@nestjs/core": "^6.7.2", "@nestjs/mongoose": "^6.1.2", "@nestjs/platform-express": "^6.7.2", "mongoose": "^5.8.7", "reflect-metadata": "^0.1.13", "rimraf": "^3.0.0", "rxjs": "^6.5.3" }, "devDependencies": { "@nestjs/cli": "^6.9.0", "@nestjs/schematics": "^6.7.0", "@nestjs/testing": "^6.7.1", "@types/express": "^4.17.2", "@types/jest": "^24.0.18", "@types/node": "^12.7.5", "@types/supertest": "^2.0.8", "jest": "^24.9.0", "prettier": "^1.18.2", "supertest": "^4.0.2", "ts-jest": "^24.1.0", "ts-loader": "^6.1.1", "ts-node": "^8.4.1", "tsconfig-paths": "^3.9.0", "tslint": "^5.20.1", "typescript": "^3.7.4" },

and here is my workflow

` name: Node CI

on: [push, pull_request]

jobs: build:

runs-on: ubuntu-latest

strategy:
  matrix:
    node-version: [8.x, 10.x, 12.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
  uses: actions/setup-node@v1
  with:
    node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
  run: |
    npm ci
    npm run build --if-present
    npm run lint
    npm test
  env:
    CI: true

`

also tried with npm install instead of npm ci and npm run build instead of npm run build --if-present

korsour commented 4 years ago

Facing the same issue

I have the same problem, but it's building just fine on my computer but not in my GitHub actions workflow which is a linux machine.

maitrungduc1410 commented 4 years ago

I have same problem, and finally I found out that NodeJS version 8.x is not working (at the moment: Oct 2020)

Node 10 and 12 work fine

mustafashykh commented 3 years ago

I having the same issue here but in pipelines and ubuntu 20.04

Screenshot 2021-02-23 at 1 31 45 AM
jmcdo29 commented 3 years ago

Thanks for reporting, but none of you have done what Kamil has asked and provided a minimum reproduction/ The stack traces and build errors don't help much if we can't see the code producing the errors.

mustafashykh commented 3 years ago

It's hard to provide a code sample, I'll try, the GitHub actions and my server both use ubuntu 20.04, so it's pretty sure the problem occurs with Linux env, moreover; I have noticed in build sometime the directories aren't mapping with the write casing, macOS is somehow handling this behaviour but Linux isn't. While I was surfing StackOverflow I can across this

Link

as for what I did for the time being

  • changed all directories to lowercase
  • made a build my local machine. (macOS) (BigSur) (11.2.1) with node (v14.15.4)
  • SCP the dist to the server and ran it :p and somehow it's working
jmcdo29 commented 3 years ago

If it helps to know, Linux file directories are case sensitive, while MacOS directories are not. So whle on MacOS src/Mailer/mailer.service may be valid, it may need to be src/mailer/mailer.service on Linux. Most of the time when dealing with file directories for code, i personally prefer to keep everything lowercase, just makes it easier to look at and read from, in my opinion.

mustafashykh commented 3 years ago

I don't know to be happy or sad right now, but I did the following

  • VSCode was ignoring the case sensitiveness
  • so I cross-checked the paths with the errors I was getting on Github actions
  • fixed all the paths
  • all the errors are gone and my ci/cd and server are working accordingly.