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

cli can`t build anymore #1865

Closed
2 of 4 tasks
pharindoko opened this issue Dec 29, 2022 · 9 comments
Closed
2 of 4 tasks

cli can`t build anymore #1865

pharindoko opened this issue Dec 29, 2022 · 9 comments

Comments

@pharindoko
Copy link

pharindoko commented Dec 29, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

using 9.1.7 when I run

npm run build or nest build

the process doesn´t end.
Recognized it when CI / CD got stuck.

Build process runs as expected when v 9.1.5 is used.

Minimum reproduction code

https://github.com/kelseyhightower/nocode

Steps to reproduce

  1. npm i
  2. npm i -D @nestjs/cli@latest
  3. nest build

Expected behavior

build process ends as expected.

Package version

9.1.7

NestJS version

9

Node.js version

v14.19.2

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

nest cli config

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "assets": [
      "shared/mail/templates/**",
      {
        "include": "../views",
        "outDir": "dist/views",
        "watchAssets": true
      }
    ],
    "watchAssets": true,
    "plugins": [
      {
        "name": "@nestjs/swagger",
        "options": {
          "classValidatorShim": true,
          "introspectComments": true
        }
      }
    ]
  }
}
@pharindoko
Copy link
Author

pharindoko commented Dec 29, 2022

ok fine - recognized it works if nest-cli.json is an empty object...

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {}
   
}

updated nest schematics to latest version 9.0.4 after using 9.0.3 - no change
...works without the compiler options set...

@pharindoko
Copy link
Author

pharindoko commented Dec 29, 2022

Ok I narrowed it down to the assets part in the compilerOptions

{
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "assets": [
      "shared/mail/templates/**",
      {
        "include": "../views",
        "outDir": "dist/views",
        "watchAssets": true
      }
    ]
  }
}

and it doesn`t matter which asset I keep in the array - fails with both options...

Just to mention it:

using nest build --watch compiles correctly

[12:12:11 PM] Starting compilation in watch mode...

[12:12:22 PM] Found 0 errors. Watching for file changes.

@micalevisk
Copy link
Member

I guess this has something to do with your project's file structure + assets.

Hard to tell without a reproduction project.

@piotar
Copy link

piotar commented Dec 29, 2022

I have the same problem

nest build won't work properly.

The watchAssets option set to true in compilerOptions are blocking the project build. (watching mode was on ? in build ?)

The problem occurs after updating @nestjs/cli to version 9.1.7.

@micalevisk
Copy link
Member

micalevisk commented Dec 29, 2022

@piotar so you didn't changed anything other upgrading @nestjs/cli? also, can you share the output of npx nest info

@piotar
Copy link

piotar commented Dec 29, 2022

I just updated @nestjs/cli form "9.1.5 to "9.1.7 and @nestjs/axios from 1.0.0 to 1.0.1

npx nest info

[System Information]
OS Version     : macOS
NodeJS Version : v18.12.1
NPM Version    : 8.19.2 

[Nest CLI]
Nest CLI Version : 9.1.7 

[Nest Platform Information]
platform-express version : 9.2.1
swagger version          : 6.1.4
testing version          : 9.2.1
common version           : 9.2.1
axios version            : 1.0.1
core version             : 9.2.1
cli version              : 9.1.7

@micalevisk
Copy link
Member

micalevisk commented Dec 29, 2022

this regression maybe have been introduced in fee2571

@kamilmysliwiec
Copy link
Member

Reverted in 9.1.8

@hsycc
Copy link

hsycc commented Mar 22, 2023

This problem still exists in version 9.2.0.

Reverted in 9.3.0.

And in @nestjs/cli/lib/compiler/helpers/copy-path-resolve.js line 20.

   if (depth(inPath) < up) {
        throw new Error('cant go up that far');
    }

Like restricting the copying of root files to dist.

Assets "../*.env" is not working.

  "compilerOptions": {
      "assets": ["../client/*", "../*.env"],
      "watchAssets": true
  },

``

@nestjs nestjs locked and limited conversation to collaborators May 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants