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

NestJS - Error: The externalDependency 'webpack-cli' for 'project:build' could not be found. #29116

Open
1 of 4 tasks
Fafnur opened this issue Nov 29, 2024 · 1 comment
Open
1 of 4 tasks

Comments

@Fafnur
Copy link

Fafnur commented Nov 29, 2024

Current Behavior

If you add yarn.lock to .gitignore for a monorepo with nestjs, the project will crash with an error.

Image

Error message:

NX   Daemon process terminated and closed the connection

Please rerun the command, which will restart the daemon.
If you get this error again, check for any errors in the daemon process logs found in: /mnt/Storage/Development/angular/nx-gitignore-bug/.nx/workspace-data/d/daemon.log

If you remove yarn.lock from .gitignore, everything is fine.

Image

Expected Behavior

Adding yarn.lock should not affect server startup with yarn.

GitHub Repo

https://github.com/Fafnur/nx-gitignore-bug

Steps to Reproduce

  1. Generate a new workspace with nx Image
  2. Set yarn as default manager in package.json "packageManager": "[email protected]"
  3. Create .yarnrc.yml with content nodeLinker: node-modules
  4. Add yarn.lock in .gitignore

Nx Report

Node           : 22.11.0
OS             : linux-x64
Native Target  : x86_64-linux
yarn           : 4.5.3

nx                 : 20.1.4
@nx/js             : 20.1.4
@nx/jest           : 20.1.4
@nx/eslint         : 20.1.4
@nx/workspace      : 20.1.4
@nx/devkit         : 20.1.4
@nx/eslint-plugin  : 20.1.4
@nx/nest           : 20.1.4
@nx/node           : 20.1.4
@nx/web            : 20.1.4
@nx/webpack        : 20.1.4
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin

Failure Logs

/mnt/Storage/Development/angular/taro/node_modules/nx/src/hasher/native-task-hasher-impl.js:32
        const plans = this.planner.getPlansReference(tasks.map((t) => t.id), taskGraph);
                                   ^

Error: The externalDependency 'webpack-cli' for 'backend:build' could not be found
    at NativeTaskHasherImpl.hashTasks (/mnt/Storage/Development/angular/taro/node_modules/nx/src/hasher/native-task-hasher-impl.js:32:36)
    at InProcessTaskHasher.hashTasks (/mnt/Storage/Development/angular/taro/node_modules/nx/src/hasher/task-hasher.js:41:46)
    at handleHashTasks (/mnt/Storage/Development/angular/taro/node_modules/nx/src/daemon/server/handle-hash-tasks.js:30:56)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async handleResult (/mnt/Storage/Development/angular/taro/node_modules/nx/src/daemon/server/server.js:172:16)
    at async handleMessage (/mnt/Storage/Development/angular/taro/node_modules/nx/src/daemon/server/server.js:110:9)
    at async /mnt/Storage/Development/angular/taro/node_modules/nx/src/daemon/server/server.js:72:9 {
  code: 'GenericFailure'
}

Node.js v22.11.0

Package Manager Version

4.5.3

Operating System

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

Additional Information

No response

@Fafnur Fafnur changed the title Error: The externalDependency 'webpack-cli' for 'project:build' could not be found NestJS - Error: The externalDependency 'webpack-cli' for 'project:build' could not be found. Nov 29, 2024
@mataai
Copy link

mataai commented Dec 3, 2024

I have the same exact problem. Added package-lock.json to gitignore monorepo wouldn't start even after re-cloning the repo and fresh modules install.
Removing package-lock.json from .gitignore instantly fixed it.

Node           : 20.11.1
OS             : win32-x64
Native Target  : x86_64-windows
npm            : 10.5.0

nx (global)        : 20.1.4
nx                 : 20.1.4
@nx/js             : 20.1.4
@nx/jest           : 20.1.4
@nx/eslint         : 20.1.4
@nx/workspace      : 20.1.4
@nx/angular        : 20.1.4
@nx/devkit         : 20.1.4
@nx/eslint-plugin  : 20.1.4
@nx/nest           : 20.1.4
@nx/node           : 20.1.4
@nx/web            : 20.1.4
@nx/webpack        : 20.1.4
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
angular-eslint : 18.4.3

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

2 participants