Open pct-tploeger opened 1 week ago
Seems similar to #27571
Also getting the same issue - the error happens when trying to re-build after a file changes when using the serve command
I was on 20.1.2
and tried upgrading to see if that would resolve the issue.
We were using @nx/esbuild
and we switched to @nx/webpack
because we have some static files that we modify often and @nx/esbuild
does not auto-restart and I could not find a way to watch these files.
The serve command is using @nx/js:node
Node : 20.14.0
OS : darwin-arm64
Native Target : aarch64-macos
yarn : 1.22.22
nx : 20.1.3
@nx/js : 20.1.3
@nx/jest : 20.1.3
@nx/eslint : 20.1.3
@nx/workspace : 20.1.3
@nx/devkit : 20.1.3
@nx/esbuild : 20.1.3
@nx/eslint-plugin : 20.1.3
@nx/node : 20.1.3
@nx/playwright : 20.1.3
@nx/react : 20.1.3
@nx/vite : 20.1.3
@nx/web : 20.1.3
@nx/webpack : 20.1.3
typescript : 5.5.4
---------------------------------------
Registered Plugins:
@nx/playwright/plugin
NX An error occured while creating pruned lockfile
Please open an issue at `https://github.com/nrwl/nx/issues/new?template=1-bug.yml` and provide a reproduction.
To prevent the build from breaking we are returning the root lock file.
Original error: Target project does not exist: npm:escape-string-regexp@1.0.5
Error: Target project does not exist: npm:escape-string-regexp@1.0.5
at validateCommonDependencyRules (/Users/me/dev/company/frontend/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
at validateDependency (/Users/me/dev/company/frontend/node_modules/nx/src/project-graph/project-graph-builder.js:314:5)
at ProjectGraphBuilder.addDependency (/Users/me/dev/company/frontend/node_modules/nx/src/project-graph/project-graph-builder.js:191:9)
at ProjectGraphBuilder.addStaticDependency (/Users/me/dev/company/frontend/node_modules/nx/src/project-graph/project-graph-builder.js:90:14)
at /Users/me/dev/company/frontend/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:80:17
at Array.forEach (<anonymous>)
at traverseNode (/Users/me/dev/company/frontend/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:77:36)
at /Users/me/dev/company/frontend/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:79:9
at Array.forEach (<anonymous>)
at traverseNode (/Users/me/dev/company/frontend/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:77:36)
There is a different dependency mentioned each time
Original error: Target project does not exist: npm:chalk@2.4.2
Original error: Target project does not exist: npm:es-errors@1.0.0
Original error: Target project does not exist: npm:axios@1.7.7
Here is our project definition:
{
"name": "service-name",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "service-name/src",
"projectType": "application",
"tags": ["server"],
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"target": "node",
"compiler": "tsc",
"outputPath": "service-name/dist",
"main": "service-name/src/main.ts",
"tsConfig": "service-name/tsconfig.app.json",
"assets": [
"service-name/src/assets",
{
"glob": "**/*",
"input": "service-name/templates",
"output": "templates"
}
],
"webpackConfig": "service-name/webpack.config.js",
"generatePackageJson": true
},
"configurations": {
"development": {},
"production": {
"generateLockfile": true,
"esbuildOptions": {
"sourcemap": false,
"outExtension": {
".js": ".js"
}
}
}
}
},
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"dependsOn": [],
"options": {
"buildTarget": "service-name:build",
"runBuildTargetDependencies": false
},
"configurations": {
"development": {
"buildTarget": "service-name:build:development"
},
"production": {
"buildTarget": "service-name:build:production"
}
}
},
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "service-name/jest.config.ts"
}
},
"docker-build": {
"dependsOn": ["build"],
"command": "docker build -f service-name/Dockerfile . -t service-name"
}
}
}
Current Behavior
I get the same error this issue mentions: #26296
I also got the message to create a ticket here. The same situation as the above mentioned issue applies: I have a node app that auto-reloads and throws the error pasted below. Only difference is, that its a different package that seems to be at fault here.
Expected Behavior
No error messages.
GitHub Repo
No response
Steps to Reproduce
1.
Nx Report
Failure Logs
Package Manager Version
No response
Operating System
Additional Information
I have logged the output of the external nodes in the same way the error above does, where I get a similar output:
When running
npm ls finalhandler
I get a different result as the issue mentioned above:Here is no type package mentioned, but it has two different versions aswell.