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

serve and build commands failed after updating to Nx 15 #13143

Closed
Ali-Hussein-dev opened this issue Nov 12, 2022 · 10 comments
Closed

serve and build commands failed after updating to Nx 15 #13143

Ali-Hussein-dev opened this issue Nov 12, 2022 · 10 comments
Assignees
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug

Comments

@Ali-Hussein-dev
Copy link

Current Behavior

only one application can't be run locally, nx serve kartebuch failed

Expected Behavior

run all applications locally

Steps to Reproduce

The repo is private and can't share the PR currently.

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

The "path" argument must be of type string. Received undefined

Environment

Node : 16.17.0
OS : win32 x64
npm : 7.6.3

nx : 15.0.13
@nrwl/angular : Not Found
@nrwl/cypress : 15.0.13
@nrwl/detox : Not Found
@nrwl/devkit : 15.0.13
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : 15.0.13
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 15.0.13
@nrwl/js : 15.0.13
@nrwl/linter : 15.0.13
@nrwl/nest : Not Found
@nrwl/next : 15.0.13
@nrwl/node : 15.0.13
@nrwl/nx-cloud : 15.0.2
@nrwl/nx-plugin : Not Found
@nrwl/react : 15.0.13
@nrwl/react-native : Not Found
@nrwl/rollup : 15.0.13
@nrwl/schematics : Not Found
@nrwl/storybook : 15.0.13
@nrwl/web : 15.0.13
@nrwl/webpack : 15.0.13
@nrwl/workspace : 15.0.13
typescript : 4.8.4

Debug log

1 info using npm@7.6.3
2 info using node@v16.17.0
3 timing config:load:defaults Completed in 2ms
4 timing config:load:file:C:\Users\alilo\AppData\Roaming\npm\node_modules\npm\npmrc Completed in 3ms
5 timing config:load:builtin Completed in 4ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:C:\Users\alilo\Projects\green-menus.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\alilo.npmrc Completed in 1ms
11 timing config:load:user Completed in 1ms
12 timing config:load:file:C:\Users\alilo\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 11ms
19 verbose npm-session 158a473615dcfc08
20 timing npm:load Completed in 20ms
21 timing command:run Completed in 8046ms
22 verbose stack Error: command failed
22 verbose stack at ChildProcess. (C:\Users\alilo\AppData\Roaming\npm\node_modules\npm\node_modules@npmcli\promise-spawn\index.js:64:27)
22 verbose stack at ChildProcess.emit (node:events:513:28)
22 verbose stack at maybeClose (node:internal/child_process:1093:16)
22 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
23 verbose pkgid green-menus@0.0.0
24 verbose cwd C:\Users\alilo\Projects\green-menus
25 verbose Windows_NT 10.0.22621
26 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\alilo\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "d:1"
27 verbose node v16.17.0
28 verbose npm v7.6.3
29 error code 1
30 error path C:\Users\alilo\Projects\green-menus
31 error command failed
32 error command C:\WINDOWS\system32\cmd.exe /d /s /c nx serve kartebuch
33 verbose exit 1

workspace.json for the failed application.

{
"projects": {
"kartebuch": {
      "$schema": "../../node_modules/nx/schemas/project-schema.json",
      "root": "apps/kartebuch",
      "sourceRoot": "apps/kartebuch",
      "projectType": "application",
      "targets": {
        "build": {
          "executor": "@nrwl/next:build",
          "outputs": ["{options.outputPath}"],
          "defaultConfiguration": "production",
          "options": {
            "root": "apps/kartebuch",
            "outputPath": "dist/apps/kartebuch"
          },
          "configurations": {
            "production": {
              "buildTarget": "kartbuch:build:production",
              "dev": false
            },
            "development": {
              "outputPath": "apps/kartebuch"
            }
          }
        },
        "serve": {
          "executor": "@nrwl/next:server",
          "options": {
            "buildTarget": "kartebuch:build",
            "dev": true,
            "port": 3000,
            "hostname": "localhost"
          },
          "configurations": {
            "production": {
              "buildTarget": "kartebuch:build:production",
              "dev": false
            },
            "development": {
              "buildTarget": "kartebuch:build:development",
              "dev": true
            }
          },
          "defaultConfiguration": "development"
        },
        "export": {
          "executor": "@nrwl/next:export",
          "options": {
            "buildTarget": "kartebuch:build:production"
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["{workspaceRoot}/coverage/apps/kartebuch"],
          "options": {
            "jestConfig": "apps/kartebuch/jest.config.ts",
            "passWithNoTests": true
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "outputs": ["{options.outputFile}"],
          "options": {
            "lintFilePatterns": ["apps/kartebuch/**/*.{ts,tsx,js,jsx}"]
          }
        }
      },
      "tags": [],
      "name": "kartebuch"
    }
} 
}
@AgentEnder
Copy link
Member

Can you provide a minimal repro for this? At minimum, adding --verbose and setting NX_VERBOSE_LOGGING=true may help provide some more info

@Ali-Hussein-dev
Copy link
Author

Ali-Hussein-dev commented Nov 13, 2022

Hi @AgentEnder this is the stack trace I got.

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
`
stacktrace

at new NodeError (node:internal/errors:387:5)

at validateString (node:internal/validators:121:11)

at Object.join (node:path:429:7)

at Object.webpack (C:\Users\alilo\Projects\green-menus\node_modules\@nrwl\next\plugins\with-nx.js:41:33)

at webpack (C:\Users\alilo\Projects\green-menus\node_modules\next-translate\lib\cjs\plugin\index.js:58:30)

at Object.config.webpack (C:\Users\alilo\Projects\green-menus\node_modules\@nrwl\next\src\utils\config.js:60:163)

at Object.getBaseWebpackConfig [as default] (C:\Users\alilo\Projects\green-menus\node_modules\next\dist\build\webpack-config.js:1413:32)

at async Promise.all (index 0)

at async Span.traceAsyncFn (C:\Users\alilo\Projects\green-menus\node_modules\next\dist\trace\trace.js:79:20)

at async Span.traceAsyncFn (C:\Users\alilo\Projects\green-menus\node_modules\next\dist\trace\trace.js:79:20)

`

@AgentEnder AgentEnder added scope: nextjs Issues related to NextJS support for Nx and removed blocked: more info needed labels Nov 13, 2022
@elucidsoft
Copy link

Same issue

@vladIsLove-hub
Copy link

Same problem

@Ali-Hussein-dev
Copy link
Author

Ali-Hussein-dev commented Nov 19, 2022

@elucidsoft @vladIsLove-hub do you have next-compose-plugins installed in your repo? it might be causing this issue. I added it to a new nx repo, the local server stopped working and throw the same error.

@vladIsLove-hub
Copy link

No, I dont have such plugin :)
Just I've tried run the built-in NX webpack devserver executor, and I have the same error. In general I assume that it happen in several built-in NX executors and I don't like it, when the whole Nx command even can't test their code (just facepalm)

@Ali-Hussein-dev
Copy link
Author

@AgentEnder here is the repo for the bug URL

@jaysoo
Copy link
Member

jaysoo commented Nov 23, 2022

The issue is that next-compose-plugins is passing in its own context data that conflicts with Nx context. I'll patch this.

@jaysoo
Copy link
Member

jaysoo commented Nov 23, 2022

Current workaround is to not use next-compose-plugins and chain the plugins manually, like:

module.exports = withNx(withTranslate({ ... }));

Fix will be in the next patch release. #13358

@jaysoo jaysoo closed this as completed Nov 23, 2022
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: nextjs Issues related to NextJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

5 participants