引入一个打包的模块时报了这个个错:

$ rimraf out
Done in 16.81s.
lerna ERR! build Errored while running script in 'map'
lerna ERR! execute callback with error
lerna ERR! Error: Command failed: yarn run build
lerna ERR! warning package.json: License should be a valid SPDX license expression
lerna ERR! warning ../../../package.json: No license field
lerna ERR!
lerna ERR! ERROR in Error: Ng2WindowModule is not an NgModule
lerna ERR! at _getNgModuleMetadata (/Users/machan/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@angular/compiler-cli/src/ngtools_impl.js:140:15)
lerna ERR! at _extractLazyRoutesFromStaticModule (/Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
lerna ERR! at /Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
lerna ERR! at Array.reduce (<anonymous>)
lerna ERR! at _extractLazyRoutesFromStaticModule (/Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
lerna ERR! at Object.listLazyRoutesOfModule (/Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
lerna ERR! at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
lerna ERR! at AotPlugin._getLazyRoutesFromNgtools (/Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@ngtools/webpack/src/plugin.js:240:66)
lerna ERR! at _donePromise.Promise.resolve.then.then.then.then.then (/Users/**/Desktop/workspace/office/trunk-web2.5/packages/ng-apps/map/node_modules/@ngtools/webpack/src/plugin.js:493:24)
lerna ERR! at <anonymous>
lerna ERR! error Command failed with exit code 1.

这个错跟AppModule is not a NgModule的原因不一样。

试了很多方法,最后在tsconfig.json里面添加

{
...
"compilerOptions": {
...
"paths": {
...
"@**/ng2-window": ["../node_modules/@**/ng2-window/src"],
"@**/ng2-property": ["../node_modules/@**/ng2-property/src"],
"@**/ng-common": ["../node_modules/@**/ng-common/src"],
"@**/ng-core": ["../node_modules/@**/ng-core/src"]
}
},
"exclude": [
...
]
}

通过path的设置,来指定调用的模块路径。

------------------------------------------------------

AppModule is not a NgModule的报错,原因很多是跟typescript或者angular的版本有关。

ERROR in Error: ***Module is not an NgModule的更多相关文章

  1. 对express中引入文件时提示Error: Cannot find module错误的理解

    打算写个小demo,在引入一个routes文件时,一直提示Error: Cannot find module('./routes')的错误,经过一番了解. 如果要把整个文件夹下所有的模块都引进来  v ...

  2. inoic start projectname sidemenu报错 - Error: Cannot find module 'lodash._baseslice'

    inoic start projectname sidemenu报错 - Error: Cannot find module 'lodash._baseslice' 在公司的电脑上出现过这个错误,后来 ...

  3. FreeBSD修改root密码错误passwd: pam_chau(www.111cn.net)thtok(): error in service module from:http://www.111cn.net/sys/freebsd/66713.htm

    在FreeBSD中修改帐号密码有时候会出现一些错误,针对passwd: pam_chauthtok(): error in service module这样的错误提示,简单整理了以下解决方案:错误提示 ...

  4. Error: Cannot find module 'express'

    安装Express命令如下: npm install -g express 安装成功之后会在C:\Users\[YOUR_USER_NAME]\AppData\Roaming\npm\node_mod ...

  5. forever start Error: Cannot find module './daemon.v0.10.26'

    我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3590158.html,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体验 ...

  6. Error: Cannot find module 'gulp-clone'问题的解决

    安装完gulp环境,并且配置好gulpfile.js,执行静态文件压缩和代码混淆时,出现如下错误: Error: Cannot find module 'gulp-clone' Error: Cann ...

  7. 关于npm安装全局模块,require时报Error: Cannot find module 'XXX'的解决办法

    系统环境:centos 下午使用npm安装"cheerio",想搞爬虫玩玩. npm安装有两种模式: 本地 # npm install cheerio 全局 # npm insta ...

  8. 【问题解决记录】Error: Cannot find module '@ionic/app-scripts'

    主要问题为: ionic serve 编译在浏览器中预览项目时,提示报错 Error: Cannot find module '@ionic/app-scripts'.这个问题的主要现象就是创建的项目 ...

  9. Ionic3 遇到的一些错误-Error: Cannot find module 'reflect-metadata'

    E:\Projects\ionic\myApp5>ionic serve Error: Cannot find module 'reflect-metadata' 解决方法: npm insta ...

随机推荐

  1. [CSP-S模拟测试]:z(模拟+map+小根堆)

    题目背景 $\frac{1}{4}$遇到了一道水题,$eooooo$完全不会做,于是去请教小$D$.结果小$D$已经去了阿塞拜疆,于是,$\frac{1}{4}$只好来问你,这道题是这样的: 题目描述 ...

  2. [CSP-S模拟测试]:折射(DP)

    题目描述 小$Y$十分喜爱光学相关的问题,一天他正在研究折射. 他在平面上放置了$n$个折射装置,希望利用这些装置画出美丽的折线. 折线将从某个装置出发,并且在经过一处装置时可以转向,若经过的装置坐标 ...

  3. ip地址与子网掩码----基础知识

    前言 IP地址有三种基本类型,由网络号的第一组数字来表示. A类地址的第一组数字为1-126. B类地址的第一组数字为128-191. C类地址的第一组数字为192-223. 注:数字0和 127不作 ...

  4. 解决Mac下使用root 权限依旧无法读写文件的问题

    当时在学习selenium的时候,需要配合使用chromedriver 和phantomjs 进行浏览器的自动化测试.. chromedriver下载结束后.无法移动到/user/bin下面 会提示权 ...

  5. 第二章(1.3)Python基础知识(输入输出)

    一.?输出 用print加上字符串,就可以向屏幕上输出指定的文字 print?'hello, world' print也可以打印整数. >>> print?300 二.?输入 Pyt ...

  6. The 13th Chinese Northeast Collegiate Programming Contest(B C E F H J)

    B. Balanced Diet 思路:把每一块选C个产生的价值记录下来,然后从小到大枚举C. #include<bits/stdc++.h> using namespace std; ; ...

  7. MongoDB简单认识

    MongoDB 为何物 NoSQL 泛指非关系型数据库,该词是关系型数据库(即 SQL)的相对称呼.MongoDB 是非关系型数据库中较为人熟知的一种. 它拥有很多优秀特性,例如高性能.高可用.支持丰 ...

  8. python 装饰器 第八步:使用类来作为装饰器参数

    #第八步:使用类作为装饰器参数 #装饰器使用的操作类 class Wish: #祈求方法 def before(): print('饭前洗洗手') #还愿方法 def after(): print(' ...

  9. PAT甲级【2019年3月考题】——A1159 Structure_of_a_BinaryTree【30】

    Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and i ...

  10. JVM系列(一) — Jvm内存模型

    总结自<深入理解java虚拟机> 很多博客在讲虚拟机内存模型时,比较宽泛或者粗化,甚者,不准确,以下是我的一个笔记照片 运行时数据区可以分为两部分:线程共享区和线程私有区 一.线程共享区 ...