nx
nx copied to clipboard
@nx/nuxt/plugin config causing "Cannot read properties of undefined (reading 'split')" for one project not even using the plugin
Current Behavior
First of all, please please please make the logs of this error more detailed! Me and others have wasted days with this issue, walking totally in the dark and the only way to find the cause is pure trial and error!
So recently I was facing this error again "Cannot read properties of undefined (reading 'split')"
and tried to exclude my projects one by one using .nxignore
After I figured out, that it is only one of the projects causing it, it made no sense to me, so I modified my nx.json until I found out that this plugin configuration is causing the trouble:
{
"plugin": "@nx/nuxt/plugin",
"options": {
"buildTargetName": "build",
"testTargetName": "test",
"serveTargetName": "serve",
"buildStaticTargetName": "build-static",
"serveStaticTargetName": "serve-static"
}
},
This is the project.json of the affected app:
{
"name": "my-app",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"tags": ["staging", "live"],
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": ["apps/my-app/**/*.{js,jsx,ts,tsx,vue}"]
}
},
"prepare": {
"executor": "nx:run-script",
"options": {
"script": "prepare"
},
"dependsOn": [
{
"target": "prepack",
"dependencies": true
}
]
},
"test": {
"executor": "nx:run-script",
"options": {
"script": "test",
"projects": "self"
},
"dependsOn": [
{
"target": "prepare"
},
{
"target": "prepack:stub",
"dependencies": true
}
]
},
"e2e": {
"executor": "@nx/playwright:playwright",
"outputs": ["{workspaceRoot}/dist/.playwright/apps/my-app/e2e"],
"options": {
"config": "apps/my-app/playwright.config.ts"
},
"dependsOn": [
{
"target": "test"
}
]
},
"build": {
"executor": "nx:run-script",
"options": {
"script": "build"
},
"dependsOn": [
{
"target": "prepack",
"dependencies": true
},
{
"target": "test"
},
{
"target": "e2e"
}
]
},
"deploy": {
"executor": "nx:run-script",
"options": {
"script": "deploy"
},
"dependsOn": [
{
"target": "test"
},
{
"target": "e2e"
},
{
"target": "build"
}
]
},
"deploy:production": {
"executor": "nx:run-script",
"options": {
"script": "deploy"
},
"dependsOn": [
{
"target": "test"
},
{
"target": "e2e"
},
{
"target": "build"
}
]
},
"dev": {
"executor": "nx:run-script",
"options": {
"script": "dev"
},
"dependsOn": [
{
"target": "prepack:stub",
"dependencies": true
}
]
},
"verify": {
"dependsOn": [
{
"target": "smoke"
},
{
"target": "lighthouse"
}
]
},
"lighthouse": {
"executor": "nx:run-script",
"options": {
"script": "lhci autorun"
}
},
"smoke": {
"executor": "@nx/playwright:playwright",
"outputs": ["{workspaceRoot}/dist/.playwright/apps/my-app/smoke"],
"options": {
"config": "apps/my-app/playwright.config.ts"
}
}
}
}
As far as I'm aware of, I'm not even using anything of the plugin right now, so it doesn't make sense that this app especially is causing the problem. In fact, my other apps are very similar, except the playwright /lighthouse tasks.
Both the plugin config, and the project.json are identical to my production version, but other lines of my overall nx.json have changed.
Expected Behavior
- The log message should be clear and at least point to the related file, or even log the problematic config / plugin and app
- I'd expect this app to behave like all the others, and the whole thing feels like a race condition, but maybe I made a mistake somewhere unaware of
GitHub Repo
No response
Steps to Reproduce
As far as I can tell, in my case the plugin config in my nx.json is enough to cause the issue with the one app, but I'm not sure this is reproducible, as the issue doesn't make sense in my opinion.
Nx Report
Node : 22.9.0 OS : win32-x64 Native Target : x86_64-windows yarn : 4.5.0
nx : 19.8.4 @nx/js : 19.8.4 @nx/jest : 19.8.4 @nx/linter : 19.8.4 @nx/eslint : 19.8.4 @nx/workspace : 19.8.4 @nx/devkit : 19.8.4 @nrwl/devkit : 19.6.0 @nx/esbuild : 19.8.4 @nx/eslint-plugin : 19.8.4 @nx/express : 19.8.4 @nx/node : 19.8.4 @nx/nuxt : 19.8.4 @nx/playwright : 19.8.4 @nrwl/tao : 15.9.7 @nx/vite : 19.8.4 @nx/vue : 19.8.4 @nx/web : 19.8.4 @nx/webpack : 19.8.4 typescript : 5.6.2
Registered Plugins: @nx/vite/plugin @nx/eslint/plugin @nx/playwright/plugin
Community plugins: @jnxplus/nx-gradle : 1.11.1 @nxlv/python : 19.1.3 @theunderscorer/nx-semantic-release : 2.12.0
The following packages should match the installed version of nx
- @nrwl/[email protected]
- @nrwl/[email protected]
To fix this, run nx migrate [email protected]
Failure Logs
No response
Package Manager Version
No response
Operating System
- [ ] macOS
- [ ] Linux
- [x] Windows
- [ ] Other (Please specify)
Additional Information
No response