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

[email protected] - .env file breaks nestjs app build #30040

Closed
1 of 4 tasks
nhhockeyplayer opened this issue Feb 14, 2025 · 1 comment
Closed
1 of 4 tasks

[email protected] - .env file breaks nestjs app build #30040

nhhockeyplayer opened this issue Feb 14, 2025 · 1 comment

Comments

@nhhockeyplayer
Copy link

nhhockeyplayer commented Feb 14, 2025

Current Behavior

.env file when populated with the following:

TS_NODE_PROJECT=apps/admin-api

breaks build of api application constructed by Nx

Expected Behavior

build should remain unimpeded

nestjs app should be runnable and debuggable with ANY ide

GitHub Repo

https://github.com/nhhockeyplayer/meanstack

Steps to Reproduce

create-nx-workspace --typeset=angular

-- choose integrated, and normal options to sponsor full-stack scaffold

nx add @nx/nest

nx g @nx/nest:application --directory=apps/admin-api --linter=eslint --name=admin-api --e2eTestRunner=none --strict=true

-- add the following to root environment file .env

NODE_ENV=development
TS_NODE_PROJECT=apps/admin-api

-- build nestjs app

nx build admin-api

this is very quickly reproducible

hoping for fast turn around so I can have my backend @nestjs intrinsic database seeder up and running LIVE

Nx Report

meanstack02@admin 20.4.4 % nx report
Unable to find local plugin [] Map(0) {}
Unable to find local plugin [] Map(0) {}
Unable to find local plugin [] Map(0) {}

 NX   Report complete - copy this into the issue template

Node           : 22.0.0
OS             : darwin-x64
Native Target  : x86_64-macos
yarn           : 1.22.22

nx (global)            : 20.4.4
nx                     : 20.4.4
@nx/js                 : 20.4.4
@nx/jest               : 20.4.4
@nx/eslint             : 20.4.4
@nx/workspace          : 20.4.4
@nx/angular            : 20.4.4
@nx/cypress            : 20.4.4
@nx/devkit             : 20.4.4
@nx/esbuild            : 20.4.4
@nx/eslint-plugin      : 20.4.4
@nx/express            : 20.4.4
@nx/module-federation  : 20.4.4
@nx/nest               : 20.4.4
@nx/node               : 20.4.4
@nx/playwright         : 20.4.4
@nx/web                : 20.4.4
@nx/webpack            : 20.4.4
typescript             : 5.7.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/webpack/plugin
@nx/cypress/plugin
@nx/eslint/plugin
@nx/webpack/plugin
---------------------------------------
Community plugins:
@compodoc/compodoc               : 1.1.26
@fortawesome/angular-fontawesome : 1.0.0
@ionic/angular                   : 8.4.3
@jsverse/transloco               : 7.5.1
@ngrx/component                  : 19.0.0
@ngrx/component-store            : 19.0.0
@ngrx/effects                    : 19.0.0
@ngrx/entity                     : 19.0.0
@ngrx/operators                  : 19.0.0
@ngrx/router-store               : 19.0.0
@ngrx/schematics                 : 19.0.1
@ngrx/store                      : 19.0.0
@ngrx/store-devtools             : 19.0.1
@nxext/capacitor                 : 20.1.0
@nxext/ionic-angular             : 20.0.5
angular-eslint                   : 19.1.0
apollo-angular                   : 8.0.2

Failure Logs

> nx run admin-api:build

> webpack-cli build --node-env=production

[webpack-cli] Error: ENOENT: no such file or directory, lstat 'apps/admin-api'
    at Object.lstatSync (node:fs:1631:25)
    at resolveConfigPath (/Users/meanstack02/2025/20.4.4/node_modules/tsconfig-paths/lib/tsconfig-loader.js:51:31)
    at loadSyncDefault (/Users/meanstack02/2025/20.4.4/node_modules/tsconfig-paths/lib/tsconfig-loader.js:33:22)
    at tsConfigLoader (/Users/meanstack02/2025/20.4.4/node_modules/tsconfig-paths/lib/tsconfig-loader.js:27:22)
    at configLoader (/Users/meanstack02/2025/20.4.4/node_modules/tsconfig-paths/lib/config-loader.js:28:22)
    at Object.loadConfig (/Users/meanstack02/2025/20.4.4/node_modules/tsconfig-paths/lib/config-loader.js:8:12)
    at new TsconfigPathsPlugin (/Users/meanstack02/2025/20.4.4/node_modules/tsconfig-paths-webpack-plugin/lib/plugin.js:33:40)
    at NxTsconfigPathsWebpackPlugin.apply (/Users/meanstack02/2025/20.4.4/node_modules/@nx/webpack/src/plugins/nx-typescript-webpack-plugin/nx-tsconfig-paths-webpack-plugin.js:26:47)
    at createCompiler (/Users/meanstack02/2025/20.4.4/node_modules/webpack/lib/webpack.js:81:12)
    at create (/Users/meanstack02/2025/20.4.4/node_modules/webpack/lib/webpack.js:154:16) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'lstat',
  path: 'apps/admin-api'
}
Warning: command "webpack-cli build --node-env=production" exited with non-zero status code
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 NX   Running target build for project admin-api failed

Failed tasks:

- admin-api:build

Hint: run the command with --verbose for more details.


 NX   Storing terminal outputs for admin-api:build with hash 2913687780444135944

View structured, searchable error logs at https://nx.app/runs/F0ut6DE95B

Package Manager Version

npm --version 10.5.1 yarn --version 1.22.22

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

main purpose to rig tsconfig-paths/ts-node was to create a debugger configuration runnable from npm script RUN-DEBUG

and tsconfig-paths is breaking internally when its .env var is used to target the nestjs app

  • committer MUST secure the build
  • committer MUST secure full back end debugging in all IDE
@nhhockeyplayer nhhockeyplayer changed the title .env file breaks nestjs app build [email protected] - .env file breaks nestjs app build Feb 17, 2025
@nhhockeyplayer
Copy link
Author

closing this due to changing build generator and serve executors across releases

cannot reproduce in latest 20.4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant