Running basic express app, nothing crazy, everything worked on NX 15. After upgrade and standard:
nx migrate latest
nx migrate --run-migrations
rm -rf node_modules
npm i
getting this error:
> nx run api:serve --port 3000 --inspect
> NX Unable to resolve @nx/node:webpack.
Cannot find executor 'webpack' in ...\node_modules\@nx\node\executors.json.
..\node_modules@nx\node\executors.json looks like this:
{
"executors": {
"node": {
"implementation": "./src/executors/node/node.impl",
"schema": "./src/executors/node/schema.json",
"description": "Execute a Node application."
}
},
"builders": {
"node": {
"implementation": "./src/executors/node/compat",
"schema": "./src/executors/node/schema.json",
"description": "Execute a Node application."
}
}
}
and project.json looks like this:
{
"name": "api",
"$schema": "..\\..\\node_modules\\nx\\schemas\\project-schema.json",
"sourceRoot": "apps/api/src",
"projectType": "application",
"targets": {
"build": {
"executor": "@nx/node:webpack",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/api",
"main": "apps/api/src/server.ts",
"tsConfig": "apps/api/tsconfig.app.json",
"assets": ["apps/api/src/assets"]
},
"configurations": {
"production": {
"optimization": true,
"extractLicenses": true,
"inspect": false,
"fileReplacements": [
{
"replace": "apps/api/src/environments/environment.ts",
"with": "apps/api/src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"executor": "@nx/node:node",
"options": {
"buildTarget": "api:build"
},
"configurations": {
"production": {
"buildTarget": "api:build:production"
}
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/api/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/api"],
"options": {
"jestConfig": "apps/api/jest.config.ts",
"passWithNoTests": true
}
}
},
"tags": []
}
Both commands nx build
and nx serve
throw webpack error. Not sure what is the fix here
Let me know if you need more details
Update: Solution bellow
I just simply created another node/express app and copied all the files from API app to NEW_API..
# create new
nx g @nx/express:app new-api --frontendProject client
# remove old
nx g @nx/workspace:rm api
# rename
nx g mv --project new-api api
that's it, no issues with running NEW_API...
...sorry if my lack of interest to trying to resolve this disappoints you =)