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

nx application is not opening nx run app-api:serve:development #21838

Open
shalendrasingh opened this issue Feb 16, 2024 · 16 comments
Open

nx application is not opening nx run app-api:serve:development #21838

shalendrasingh opened this issue Feb 16, 2024 · 16 comments
Assignees
Labels
scope: node Issues related to Node, Express, NestJS support for Nx type: bug

Comments

@shalendrasingh
Copy link

Current Behavior

Whenever I tried to serve the NX application I did not get any error or response.

this is what is shown in the terminal

 pnpm nx serve app-api

 >  NX   Running target serve for project app-api and 1 task it depends on:

 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run app-api:generate-build-info

{
  buildVersion: 'ver-local-46c5838960869212f41cc902af4474587b030c02',
  buildAt: '2024-02-16T06:58:50.721Z'
}
Build info written to C:\Users\DELL\Desktop\New folder\app-pg\packages\app-api\build-info.json

> nx run app-api:serve:development

Expected Behavior

My expectation is application will run or throw some error

GitHub Repo

No response

Steps to Reproduce

just run pnpm nx serve app-api

Nx Report

Whenever I tried to serve the NX application I did not get any error or response.

this is what is shown in the terminal

 pnpm nx serve app-api

 >  NX   Running target serve for project app-api and 1 task it depends on:

 ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run app-api:generate-build-info

{
  buildVersion: 'ver-local-46c5838960869212f41cc902af4474587b030c02',
  buildAt: '2024-02-16T06:58:50.721Z'
}
Build info written to C:\Users\DELL\Desktop\New folder\app-pg\packages\app-api\build-info.json

> nx run app-api:serve:development


### Failure Logs

_No response_

### Package Manager Version

_No response_

### Operating System

- [ ] macOS
- [ ] Linux
- [X] Windows
- [ ] Other (Please specify)

### Additional Information

_No response_
@AgentEnder
Copy link
Member

Hey, can you provide the output of nx report as well as the output of nx show project app-api? If possible the a reproduction repo showing the issue would be helpful as well.

@AgentEnder AgentEnder added blocked: more info needed scope: node Issues related to Node, Express, NestJS support for Nx labels Feb 16, 2024
@Ionaru
Copy link

Ionaru commented Feb 17, 2024

@AgentEnder

I am also seeing this behaviour, and was able to reproduce it like this:

Create a new workspace

npx create-nx-workspace@latest --preset angular-standalone --bundler esbuild --style css --ssr false --ci skip --e2eTestRunner none issue-21838
cd issue-21838

Modify project.json to add a dependency:

  "targets": {
    "some-task": {
      "command": "npx -y cowsay Moo"
    },
  ...
    "build": {
      "dependsOn": ["some-task"],
    ...

Run a build

nx build
❯ nx build

> nx run issue-21838:some-task

 _____
< Moo >
 -----
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

> nx run issue-21838:build:production

The command will hang, never complete and not respond to Ctrl-C. It needs to be manually killed in the task manager.

image

❯ nx report

 >  NX   Report complete - copy this into the issue template

   Node   : 20.10.0
   OS     : win32-x64
   npm    : 10.3.0

   nx (global)        : 18.0.4
   nx                 : 18.0.4
   @nx/js             : 18.0.4
   @nx/jest           : 18.0.4
   @nx/linter         : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/angular        : 18.0.4
   @nx/cypress        : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   @nrwl/tao          : 18.0.4
   @nx/web            : 18.0.4
   @nx/webpack        : 18.0.4
   typescript         : 5.3.3
❯ nx show project issue-21838
{"root":".","includedScripts":[],"name":"issue-21838","targets":{"lint":{"cache":true,"inputs":["default","{workspaceRoot}/.eslintrc.json","{workspaceRoot}/tools/eslint-rules/**/*",{"externalDependencies":["eslint"]}],"executor":"nx:run-commands","options":{"cwd":".","command":"eslint ./src"},"configurations":{}},"test":{"options":{"cwd":".","command":"jest"},"cache":true,"inputs":["default","^production",{"externalDependencies":["jest"]}],"outputs":["{projectRoot}\\coverage\\issue-21838"],"executor":"nx:run-commands","configurations":{}},"build":{"executor":"@angular-devkit/build-angular:application","cache":true,"dependsOn":["some-task"],"inputs":["production","^production"],"outputs":["{options.outputPath}"],"options":{"outputPath":"dist/issue-21838","index":"./src/index.html","browser":"./src/main.ts","polyfills":["zone.js"],"tsConfig":"./tsconfig.app.json","assets":["./src/favicon.ico","./src/assets"],"styles":["./src/styles.css"],"scripts":[]},"configurations":{"production":{"budgets":[{"type":"initial","maximumWarning":"500kb","maximumError":"1mb"},{"type":"anyComponentStyle","maximumWarning":"2kb","maximumError":"4kb"}],"outputHashing":"all"},"development":{"optimization":false,"extractLicenses":false,"sourceMap":true}},"defaultConfiguration":"production"},"some-task":{"executor":"nx:run-commands","options":{"command":"npx -y cowsay Moo"},"configurations":{}},"serve":{"dependsOn":["some-task"],"executor":"@angular-devkit/build-angular:dev-server","configurations":{"production":{"buildTarget":"issue-21838:build:production"},"development":{"buildTarget":"issue-21838:build:development"}},"defaultConfiguration":"development","options":{}},"extract-i18n":{"executor":"@angular-devkit/build-angular:extract-i18n","options":{"buildTarget":"issue-21838:build"},"configurations":{}}},"sourceRoot":"./src","projectType":"application","$schema":"node_modules/nx/schemas/project-schema.json","prefix":"issue-21838","tags":[],"implicitDependencies":[]}

Removing the dependsOn fixes the build. A script in package.json can produce the same behaviour as a workaround.

@Ionaru
Copy link

Ionaru commented Feb 17, 2024

Probably related to #21744 and #21779

@Ionaru
Copy link

Ionaru commented Feb 17, 2024

Looks like setting the environment variable NX_NATIVE_COMMAND_RUNNER=false can also work as a workaround.

@CMiksche
Copy link

I have the same issue after upgrading from 17.2.8 to 18.0.4.

Looks like setting the environment variable NX_NATIVE_COMMAND_RUNNER=false can also work as a workaround.

This didn't help in my case.

Hey, can you provide the output of nx report as well as the output of nx show project app-api? If possible the a reproduction repo showing the issue would be helpful as well.

My nx report

   Node   : 21.6.2
   OS     : darwin-arm64
   npm    : 10.4.0
   
   nx                 : 18.0.4
   @nx/js             : 18.0.4
   @nx/linter         : 18.0.4
   @nx/eslint         : 18.0.4
   @nx/workspace      : 18.0.4
   @nx/cypress        : 18.0.4
   @nx/devkit         : 18.0.4
   @nx/eslint-plugin  : 18.0.4
   @nx/react          : 18.0.4
   @nrwl/tao          : 18.0.4
   @nx/vite           : 18.0.4
   @nx/web            : 18.0.4
   typescript         : 5.3.3

My nx show project

{
  "root": ".",
  "name": "frontend",
  "targets": {
    "start": {
      "executor": "nx:run-script",
      "options": { "script": "start" },
      "configurations": {}
    },
    "build": {
      "executor": "@nx/vite:build",
      "dependsOn": ["^build"],
      "inputs": ["production", "^production"],
      "outputs": ["{options.outputPath}"],
      "defaultConfiguration": "production",
      "options": { "outputPath": "dist/frontend" },
      "configurations": {
        "development": { "mode": "development" },
        "production": { "mode": "production" }
      }
    },
    "test": {
      "executor": "@nx/vite:test",
      "inputs": ["default", "^production"],
      "outputs": ["{projectRoot}/coverage/frontend"],
      "options": {
        "passWithNoTests": true,
        "reportsDirectory": "coverage/frontend"
      },
      "configurations": {}
    },
    "lint": {
      "executor": "@nx/eslint:lint",
      "inputs": [
        "default",
        "{workspaceRoot}/.eslintrc.json",
        "{workspaceRoot}/.eslintignore"
      ],
      "cache": true,
      "options": { "lintFilePatterns": ["./src/**/*.{ts,tsx,js,jsx}"] },
      "configurations": {}
    },
    "serve": {
      "executor": "@nx/vite:dev-server",
      "defaultConfiguration": "development",
      "options": { "buildTarget": "frontend:build" },
      "configurations": {
        "development": {
          "buildTarget": "frontend:build:development",
          "hmr": true
        },
        "production": {
          "buildTarget": "frontend:build:production",
          "hmr": false
        }
      }
    },
    "preview": {
      "executor": "@nx/vite:preview-server",
      "defaultConfiguration": "development",
      "options": { "buildTarget": "frontend:build" },
      "configurations": {
        "development": { "buildTarget": "frontend:build:development" },
        "production": { "buildTarget": "frontend:build:production" }
      }
    }
  },
  "$schema": "node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "./src",
  "projectType": "application",
  "tags": [],
  "implicitDependencies": []
}

My project is a pretty simple Vite, React and TypeScript Project - so it is probably also easy to reproduce.

@rob4226
Copy link

rob4226 commented Feb 22, 2024

Having the same problem on Windows 10 going from Nx v17.2.8 to v18.0.4 with dependsOn.

  • If there are two items in the dependsOn array it gets stuck on the 2nd one.
  • If there is one item in the dependsOn array it gets stuck on the target trying to be run.
  • With an empty dependsOn array, the target runs fine.

So it seems like it can only run one thing before it just hangs where Ctrl+C doesn't even work.

In my case, setting NX_NATIVE_COMMAND_RUNNER=false did make things work so that was good. Not sure what that setting does though.

Copy link

github-actions bot commented Mar 8, 2024

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Mar 8, 2024
@CMiksche
Copy link

CMiksche commented Mar 8, 2024

Replying so it stays active... many people seem to have this issue.

@github-actions github-actions bot removed the stale label Mar 9, 2024
@rob4226
Copy link

rob4226 commented Mar 9, 2024

Probably related: #21965, #21978, #21779, #21744, #22094

Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Mar 24, 2024
@Lonli-Lokli
Copy link

Not stale

Copy link

github-actions bot commented Apr 9, 2024

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Apr 9, 2024
@shehan-mark
Copy link

Having the same problem on Windows 10 going from Nx v17.2.8 to v18.0.4 with dependsOn.

  • If there are two items in the dependsOn array it gets stuck on the 2nd one.
  • If there is one item in the dependsOn array it gets stuck on the target trying to be run.
  • With an empty dependsOn array, the target runs fine.

So it seems like it can only run one thing before it just hangs where Ctrl+C doesn't even work.

In my case, setting NX_NATIVE_COMMAND_RUNNER=false did make things work so that was good. Not sure what that setting does though.

This issue still persist. And this fix worked for me. Anybody knows what this NX_NATIVE_COMMAND_RUNNER var does?

@github-actions github-actions bot removed the stale label Apr 19, 2024
Copy link

github-actions bot commented May 3, 2024

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label May 3, 2024
@rubenprins
Copy link

Just ran into it, so not stale.

FrapperColin added a commit to FrapperColin/angular-challenges that referenced this issue May 11, 2024
@ajmal-penny
Copy link

Any solution for this yet? I migrated my Nx repo from 14.1.9 to 15.1.1 and I'm start to face this as well. My angular app is stuck is at the "sealing" phase. My NestJs app on the other hand is serving fine but stuck at the building phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: node Issues related to Node, Express, NestJS support for Nx type: bug
Projects
None yet
Development

No branches or pull requests

10 participants