简体   繁体   中英

Module not found: Error: Recursion in resolving in angular app

I am trying to import my module import { waitProp } from 'wait-prop';

And i have this error

ERROR in ./src/app/qr-scanner/qr-scanner.component.ts
Module not found: Error: Recursion in resolving
Stack:
  resolve: (/Users/gkucmierz/workspace/web-tools/src/app/qr-scanner) wait-prop
  newResolve: (/Users/gkucmierz/workspace/web-tools/src/app/qr-scanner) wait-prop
  parsedResolve: (/Users/gkucmierz/workspace/web-tools/src/app/qr-scanner) wait-prop module
  describedResolve: (/Users/gkucmierz/workspace/web-tools/src/app/qr-scanner) wait-prop module
  rawModule: (/Users/gkucmierz/workspace/web-tools/src/app/qr-scanner) wait-prop
  module: (/Users/gkucmierz/workspace/web-tools/src/app/qr-scanner) wait-prop
  resolve: (/Users/gkucmierz/workspace/web-tools/node_modules) ./wait-prop
  newResolve: (/Users/gkucmierz/workspace/web-tools/node_modules) ./wait-prop
  parsedResolve: (/Users/gkucmierz/workspace/web-tools/node_modules) ./wait-prop
  describedResolve: (/Users/gkucmierz/workspace/web-tools/node_modules) ./wait-prop
  relative: (/Users/gkucmierz/workspace/web-tools/node_modules/wait-prop) 
  describedRelative: (/Users/gkucmierz/workspace/web-tools/node_modules/wait-prop) 
  rawFile: (/Users/gkucmierz/workspace/web-tools/node_modules/wait-prop) 
  file: (/Users/gkucmierz/workspace/web-tools/node_modules/wait-prop) 
  relative: (/Users/gkucmierz/workspace/wait-prop) 
  describedRelative: (/Users/gkucmierz/workspace/wait-prop) 

This is my angular version:

ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.0.0
Node: 14.4.0
OS: darwin x64

Angular: 10.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.0
@angular-devkit/build-angular     0.1000.0
@angular-devkit/build-optimizer   0.1000.0
@angular-devkit/build-webpack     0.1000.0
@angular-devkit/core              10.0.0
@angular-devkit/schematics        10.0.0
@angular/cdk                      10.0.0
@angular/cli                      10.0.0
@angular/material                 10.0.0
@ngtools/webpack                  10.0.0
@schematics/angular               10.0.0
@schematics/update                0.1000.0
rxjs                              6.5.5
typescript                        3.9.5
webpack                           4.43.0

What can be wrong here?

I don`t know what should I write yet to not make it look like this post is mostly code. I did add many details including my environment versions.

Like @circleofconfusion, I am effectively seeing this on my CI (and also a docker container which does some things to my node_modules folder that are likely also to happen on a CI).

I found the argument --preserveSymlinks when passed to ng test (that is where I am seeing the error) will break the recursion (fix) resolving the module I was having an error with.

You will find this argument in https://angular.io/cli/build and you can edit your angular.json to set the property so you don't need to specify it on the commandline. You will need to add it to the options block in each of the problematic builders (likely in any of the builders that start with "@angular-devkit/build-angular"). This will tell angular to not resolve the symlinks to their actual path, and fixes the issue I have (my node_modules is actually symlinked to a shared location)

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM