简体   繁体   English

未找到模块:错误:angular 应用程序中的递归解析

[英]Module not found: Error: Recursion in resolving in angular app

I am trying to import my module import { waitProp } from 'wait-prop';我正在尝试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:这是我的 angular 版本:

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).就像@circleofconfusion 一样,我在我的 CI 上有效地看到了这一点(还有一个 docker 容器,它对我的node_modules文件夹做了一些事情,这些事情也可能发生在 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.我发现参数--preserveSymlinks传递给ng test (这是我看到错误的地方)将破坏递归(修复)解决我遇到错误的模块。

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.你会在https://angular.io/cli/build中找到这个参数,你可以编辑你的angular.json来设置属性,所以你不需要在命令行上指定它。 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").您需要将它添加到每个有问题的构建器的options块中(可能在任何以“@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)这将告诉 angular 不将符号链接解析为其实际路径,并解决我遇到的问题(我的node_modules实际上符号链接到共享位置)

Hope this helps!希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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