无法使用npm自发布库,或者在模块导入时找不到组件或冲突

时间:2019-08-29 21:01:29

标签: angular npm

我已将此用角度CLI构建的库发布到npm,并想在某些项目中使用它,问题是,安装后,我似乎无法使用它。

无论我尝试导入Shared模块如何,都会发生以下错误:

function featchData(userId)
{
    console.log(userId);
    //if you get the id, write in the rest of the code here ;)
}

如果我尝试将其添加到将要使用它的模块中:

Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.
Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.

但是在应用示例中,它运行良好,没有任何反应。寻找见解,在此先感谢!

0 个答案:

没有答案