Skip to content

NGCC Error: Node does not exist  #29624

Closed

Description

@alan-agius4

🐞 bug report

Affected Package

@angular/compiler-cli

Is this a regression?

No

Description

Node does not exist error is thrown by NGCC when a direct or transitive dependency of a module that is being processed is missing.

For example in the reproduction, when trying to process @angular/material/progress-bar it is failing, because this depends on @angular/material/core, and the later on @angular/cdk. But @angular/cdk is not installed.

The error itself is not self explanatory and might send users on a goose chase. Hence, we should handle missing dependencies more gracefully and hint the users which is the missing dependency.

🔬 Minimal Reproduction

https://github.com/alan-agius4/ngcc-node-error/tree/master

🔥 Exception or Error


throw new Error('Node does not exist: ' + node);
      ^
Error: Node does not exist: /workspace/ngcc-node-error/node_modules/@angular/material/progress-bar
    at DepGraph.dependenciesOf (/workspace/ngcc-node-error/node_modules/dependency-graph/lib/dep_graph.js:187:13)
    at DependencyResolver.sortEntryPointsByDependency (/workspace/ngcc-node-error/node_modules/@angular/compiler-cli/ngcc/src/packages/dependency_resolver.js:42:47)
    at EntryPointFinder.findEntryPoints (/workspace/ngcc-node-error/node_modules/@angular/compiler-cli/ngcc/src/packages/entry_point_finder.js:37:34)
    at Object.mainNgcc [as process] (/workspace/ngcc-node-error/node_modules/@angular/compiler-cli/ngcc/src/main.js:50:34)
    at Object. (/workspace/ngcc-node-error/index.js:4:6)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
npm ERR! Test failed.  See above for more details.

🌍 Your Environment

Angular Version:


8.0.0-beta.10

Activity

  1. added this to the needsTriage milestone on Mar 31, 2019
  2. changed the title [-]NGCC - Node does not exist error [/-] [+]NGCC Error: Node does not exist [/+] on Mar 31, 2019
  3. petebacondarwin commented on Apr 1, 2019

    @petebacondarwin
    Contributor

    We should handle this better. There is logic in ngcc to cope with this but it is obviously not working correctly in this case.

  4. modified the milestones: needsTriage, Backlog on Apr 9, 2019
  5. 3 remaining items

  6. added a commit that references this issue on May 8, 2019
    db0794b
  7. added a commit that references this issue on May 21, 2019
    a30f393
  8. wuboy0307 commented on Jul 25, 2019

    @wuboy0307

    I still get "Node does not exist" error on 8.2.0-next.2

    Node does not exist: /Users/wuboy/workspace/xinos2-ng/node_modules/ngx-papaparse
    

    If I rollback to angular/compiler-cli 8.0.3. I will show only warning:

    WARNING in Entry point 'ngx-papaparse' contains deep imports into 'papaparse/papaparse.min.js'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
    

    However there are other errors in version 8.0.3. So I can't use this version.
    Is there anything I can do? Should this be fixed by ngx-papaparse ?

  9. petebacondarwin commented on Jul 28, 2019

    @petebacondarwin
    Contributor

    @wuboy0307 - in this case the problem is that ngx-papaparse is indeed doing a deep import import * as lib from 'papaparse/papaparse.min.js'; rather than simply import * as lib from 'papaparse';.

    In the latest version of ngcc the dependency checking phase is not handling this correctly. I think we should probably be more resilient to this approach.

  10. qaxqaxqax commented on Jul 30, 2019

    @qaxqaxqax

    I have got the same issue with ngx-highlightjs:

    ERROR in Node does not exist: /Users/localadmin/D/restructure/webclients/node_modules/ngx-highlightjs

    (8.2.0-rc.0)

  11. petebacondarwin commented on Jul 30, 2019

    @petebacondarwin
    Contributor

    This crash should be fixed by #31872 but note that this failure is probably due to a missing dependency. Try running ./node_modules/.bin/ivy-ngcc -l debug. It should tell you if this package has a dependency that has not been installed.

  12. qaxqaxqax commented on Jul 30, 2019

    @qaxqaxqax

    Invalid entry-point /Users/localadmin/D/restructure/webclients/node_modules/ngx-highlightjs. It is missing required dependencies:

    • highlight.js/lib/highlight.js

    image

    Should I open a ticket at ngx-highlightjs?

  13. petebacondarwin commented on Jul 30, 2019

    @petebacondarwin
    Contributor

    @qaxqaxqax - not just yet. Can you confirm that highlight.js is indeed installed in your local project? I can see from here https://unpkg.com/browse/ngx-highlightjs@3.0.3/package.json that it is only a peer dependency, in which case you must install it yourself.

    Assuming that you have done this, then the problem is that ngx-hightlightjs is doing a "deep import" directly to a file in highlight.js rather than just a regular entry-point dependency. If so then this is a scenario that is common enough that we might want to look into fixing ngcc to cope with it...

    Edit:
    I tried it locally and it is indeed a problem with the deep import. This has occurred before with other packages so we should look at how to fix this in ngcc.... cc @JoostK :-)

  14. qaxqaxqax commented on Aug 1, 2019

    @qaxqaxqax

    I don't know if it helps but the minimal repro is:

    ng new my-project --enableIvy=true --routing=false --style=scss
    npm install -S ngx-highlightjs highlight.js

    then import HighlightModule from ngx-highlightjs at app.moudle.ts and add it to the imports of @NgModule decorator.

    ng build my-project

    and the "Error in Node does not exist: /Users/localadmin/D/restructure/my-project/node_modules/ngx-highlightjs" message appears.

  15. isawk commented on Aug 7, 2019

    @isawk

    Project configured for SSR produces similar error
    ERROR in Node does not exist: /Users/KOGA/Development/angular/telkom/node_modules/@nguniversal/express-engine

    Version Info

    @angular-devkit/architect 0.802.0
    @angular-devkit/build-angular 0.802.0
    @angular-devkit/build-optimizer 0.802.0
    @angular-devkit/build-webpack 0.802.0
    @angular-devkit/core 8.2.0
    @angular-devkit/schematics 8.2.0
    @ngtools/webpack 8.2.0
    @nguniversal/express-engine 8.1.1
    @nguniversal/module-map-ngfactory-loader 8.1.1
    @schematics/angular 8.2.0
    @schematics/update 0.802.0
    rxjs 6.4.0
    typescript 3.5.3
    webpack 4.38.0

  16. vugar005 commented on Aug 11, 2019

    @vugar005
    Contributor

    This case should be reopened. I have same error. Please loook at this issue

  17. csaszika commented on Aug 25, 2019

    @csaszika

    Hi,
    I just would like share my experience. I had the same issue with another package and ivy enabled.
    I disabled ivy then the problem appeared...my not existed package has a dependency what I have to install. Then everything works with ivy also.

    Result:
    So I think ivy need some improvements in error logging :)

  18. angular-automatic-lock-bot commented on Sep 25, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  19. locked and limited conversation to collaborators on Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions