任何帮助理解为什么我在下面安装然后在我的 Stackblitz 中引用 npm Angular2-wizard 时遇到此错误。
我有这个斯塔克闪电战我安装了Angular2 向导。安装后,我在 test.module.ts 文件中引用了它,如下所示(根据文档):
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { StripeComponent } from './stripe/stripe.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgxStripeModule } from 'ngx-stripe';
import { FormWizardModule } from 'angular2-wizard';
@NgModule({
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
FormWizardModule
],
declarations: [StripeComponent],
exports: [
StripeComponent
]
})
export class TestModule { }
我在屏幕上看到此错误:
我有预感,这是由以下方式造成的angular2-wizard
正在从他们的库中导出这些组件index.ts
:
export * from './src/wizard.component';
export * from './src/wizard-step.component';
https://github.com/maiyaporn/angular2-wizard/blob/master/index.ts
当 Stackblitz 初始化时,它将代码封装/沙箱到网络容器环境。当它试图解决问题时'./src/wizard.component'
它最有可能查看根的路线src
项目中定义的目录而不是正确的目录node_modules/angular2-wizard/src
目录。这可以解释为什么这对您本地有效但在这里无效。
我认为解决这个问题的方法是重命名src
目录到其他东西,但是似乎在 Stackblitz for Angular 项目中可能存在错误,因为它总是尝试引用/~/src/main.ts
无论 main.ts 所在目录的名称如何:
Cannot read file '/~/src/main.ts': Error: ENOENT: No such file or directory., '/~/src/main.ts'. The file is in the program because: Root file specified for compilation
我将针对 Stackblitz 提出一个错误(当我有时会链接到这个问题),但现在看来你不走运。
https://github.com/stackblitz/core/issues/2456
https://github.com/stackblitz/core/issues/2455
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)