question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Package*.json entry in angular.json assets causes node serve infinite loop

See original GitHub issue

Current Behavior

After upgrading from NX 10.0.13 to 10.1.0 When serving my Nest app in development mode it successfully compiles then starts compiling in an infinite loop. The serving an Angular is working correctly, this is specific to a node Nest app.

Note that it works if I revert the @nrwl/node dependency from 10.1.0 to 10.0.13 but leave all other nrwl dependencies alone, so it’s a regression specifically with @nrwl/node 10.1.0.

Expected Behavior

nx serve should only recompile when file in project changes and shouldn’t infinite loop.

Steps to Reproduce

I was not able to reproduce on a newly created NX Nest app but I did go through all the changes in @nrwl/node 10.1.0 and didn’t see anything that stood out to me https://github.com/nrwl/nx/commits/master/packages/node

Failure Logs

There is no failures, just infinite loop, do you have any recommendations on how to log the issue?

Environment

Working:

  nx : Not Found
  @nrwl/angular : 10.1.0
  @nrwl/cli : 10.1.0
  @nrwl/cypress : 10.1.0
  @nrwl/eslint-plugin-nx : 10.1.0
  @nrwl/express : 10.1.0
  @nrwl/jest : 10.1.0
  @nrwl/linter : 10.1.0
  @nrwl/nest : 10.1.0
  @nrwl/next : Not Found
  @nrwl/node : 10.0.13
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 10.0.13
  @nrwl/web : Not Found
  @nrwl/workspace : 10.1.0
  typescript : 3.9.7

Not Working:

  nx : Not Found
  @nrwl/angular : 10.1.0
  @nrwl/cli : 10.1.0
  @nrwl/cypress : 10.1.0
  @nrwl/eslint-plugin-nx : 10.1.0
  @nrwl/express : 10.1.0
  @nrwl/jest : 10.1.0
  @nrwl/linter : 10.1.0
  @nrwl/nest : 10.1.0
  @nrwl/next : Not Found
  @nrwl/node : 10.1.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 10.0.13
  @nrwl/web : Not Found
  @nrwl/workspace : 10.1.0
  typescript : 3.9.7

Thank you for the help!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
patheardcommented, Aug 31, 2020

Found the problem in our project’s case. We had the following in the workspace.json build config for the app:

"assets": [
   "apps/appName/src/assets",
   {
     "glob": "package*.json",
     "input": ".",
     "output": "./"
   }
]

Removing the package*.json stopped the infinite restart loop. I think the reason it was in there is because a developer had wanted package.json and package-lock.json in the app’s dist folder so they could run npm install directly from the dist.

2reactions
patheardcommented, Sep 1, 2020

So, I spoke too soon - we also need the package files to build a docker image down the line. That’s what I get for taking summer vacation and forgetting all the things 😄

Anyway, removing the * glob and explicitly listing both files also fixed the restart loop on my end. Hopefully it’ll work for you too @arjunyel:

{
  "glob": "package.json",
  "input": "./",
  "output": "./"
},
{
  "glob": "package-lock.json",
  "input": "./",
  "output": "./"
}, 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting errors on ng-serve - Stack Overflow
ng serve. In package.json I have "@angular/cli": "latest",. on ng serve I am getting this error.
Read more >
Router tutorial: tour of heroes - Angular
This tutorial provides an extensive overview of the Angular router. In this tutorial, you build upon a basic router configuration to explore features...
Read more >
48 answers on StackOverflow to the most popular Angular ...
I'm aware there are workarounds like manipulating the class or id of the DOM element upfront, but I'm hoping for a cleaner way...
Read more >
The definitive Node.js handbook - Medium
This handbook is a getting started guide to Node.js, the server-side JavaScript ... --save installs and adds the entry to the package.json file...
Read more >
Dockerizing an Angular App - Michael Herman
$ docker build -t example:dev . If RUN npm install -g @angular/cli@7.3.9 results in an infinite loop, you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found