注意:我想我能够重现这个(参见stackblitz 示例)。错误在控制台中打印为“
INTERNAL ASSERTION FAILED: Expected a class definition”。这与我在本地得到的不同,但对我来说这看起来是同一个问题。不管怎样,只需注释掉第 15 行
app.component.ts,错误就会消失。
我正在尝试开始使用 Firebase,但是当我安装和编译 Angular 项目时,出现以下错误:
Module not found: Error: Package path ./compat is not exported from package /home/sfalk/workspaces/web-mobile/node_modules/firebase (see exports field in /home/sfalk/workspaces/web-mobile/node_modules/firebase/package.json)
有趣的是,当我AuthService像这样注入我的eg时,我只会收到此错误:
import {Component, OnInit} from '@angular/core';
import {FormBuilder} from '@angular/forms';
import {AuthService} from "../../../services/auth.service";
@Component({
selector: 'app-register',
templateUrl: './register.component.html',
styleUrls: ['./register.component.scss']
})
export class RegisterComponent implements OnInit {
public loading = false;
constructor(
private formBuilder: FormBuilder,
public …Run Code Online (Sandbox Code Playgroud) 它显示这样的错误
。
/firebase.js:2:0
Module not found: Package path . is not exported from package C:\Users\krish\Desktop\FACEBOOK _CLONE\facebook_clone\node_modules\firebase (see exports field in C:\Users\krish\Desktop\FACEBOOK _CLONE\facebook_clone\node_modules\firebase\package.json)
Did you mean './firebase'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of …Run Code Online (Sandbox Code Playgroud)