Open lucas-lowry-se opened 1 month ago
I'm currently stumbling into the same issue. I'm trying to improve my linting tasks using externalDependencies
like the docs propose (https://nx.dev/reference/inputs#external-dependencies). I'm having a pnpm
monorepo using version 8.15.1
.
❯ pnpm nx report
NX Report complete - copy this into the issue template
Node : 20.17.0
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 8.15.1
nx : 19.5.7
@nx/js : 19.5.7
@nx/jest : 19.5.7
@nx/linter : 19.5.7
@nx/eslint : 19.5.7
@nx/workspace : 19.5.7
@nx/devkit : 19.5.7
@nx/node : 19.5.7
@nrwl/tao : 19.5.7
typescript : 5.5.2
When I put eslint
(which is installed as devDependency
in my package) under the externalDependencies
(project.json) I get the following error:
Error: The externalDependency 'eslint' for '<MY_LINT_TASK>' could not be found
project.json
...
"lint": {
"inputs": [
"sourceFiles",
"{projectRoot}/.eslintrc",
{
"externalDependencies": ["eslint"] # 🚨
}
],
"outputs": [],
"cache": true
},
...
package.json
...
"dependencies": {
...
"eslint": "8.57.0",
...
},
Isn't that the way the externalDependencies
are meant to work? Or am I missing something here?
I just updated to nx@19.8.2
using pnpm nx migrate latest
- the error is still happening.
I'm seeing this same thing with jest
when trying to use Atomizer to split specs using the Nx jest plugin.
$ nx test-ci settings
...
/Users/dansmith/src/looky/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 'jest' for 'settings:test-ci' could not be found
at NativeTaskHasherImpl.hashTasks (/Users/dansmith/src/looky/node_modules/nx/src/hasher/native-task-hasher-impl.js:32:36)
at InProcessTaskHasher.hashTasks (/Users/dansmith/src/looky/node_modules/nx/src/hasher/task-hasher.js:53:50)
at handleHashTasks (/Users/dansmith/src/looky/node_modules/nx/src/daemon/server/handle-hash-tasks.js:30:56)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleResult (/Users/dansmith/src/looky/node_modules/nx/src/daemon/server/server.js:107:16)
at async handleMessage (/Users/dansmith/src/looky/node_modules/nx/src/daemon/server/server.js:81:9)
at async /Users/dansmith/src/looky/node_modules/nx/src/daemon/server/server.js:45:9 {
code: 'GenericFailure'
}
Relevant part of my nx.json
:
"plugins": [
{
"plugin": "@nx/jest/plugin",
"include": ["apps/**/*", "libs/**/*"],
"options": {
"targetName": "test",
"ciTargetName": "test-ci"
}
}
]
I've removed the test
target from my settings
app's project.json
, and nx test settings
still works via inference as expected. However when trying to run nx test-ci settings
I get the above error.
This is with Nx v18.3.5 and yarn.
It happens in all plugins when running inferred tasks. I have the nx20 repo bootstrapped with ts preset. I added @nx/eslint, when I run nx lint :app, it fails.
/Users/arshath/Dev/workflows/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 'eslint' for 'model:lint' could not be found
at NativeTaskHasherImpl.hashTasks (/Users/arshath/Dev/workflows/node_modules/nx/src/hasher/native-task-hasher-impl.js:32:36)
at InProcessTaskHasher.hashTasks (/Users/arshath/Dev/workflows/node_modules/nx/src/hasher/task-hasher.js:41:46)
at handleHashTasks (/Users/arshath/Dev/workflows/node_modules/nx/src/daemon/server/handle-hash-tasks.js:30:56)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async handleResult (/Users/arshath/Dev/workflows/node_modules/nx/src/daemon/server/server.js:172:16)
at async handleMessage (/Users/arshath/Dev/workflows/node_modules/nx/src/daemon/server/server.js:110:9)
at async /Users/arshath/Dev/workflows/node_modules/nx/src/daemon/server/server.js:72:9 {
code: 'GenericFailure'
}
Node.js v20.16.0
Current Behavior
In both existing and newly created workspaces, any target involving an external dependency gets the following error and kills the daemon:
Error: The externalDependency 'cypress' for 'simple-ng-cypress-e2e:e2e' could not be found
.That particular error appears as soon as I try to open the project graph for a brand new Angular workspace set to use cypress. In other workspaces, I've seen similar behavior for
eslint
andjest
as soon as the configuration is set to use those external dependencies and not their associated plug ins.These tools are available on my PATH and runnable in the terminal used to start nx.
Expected Behavior
These targets should run without issue.
GitHub Repo
No response
Steps to Reproduce
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
I'm also using Volta as my version manager. I am not using pnpm which appears to have caused issues like this in the past.