Angular2 npm run build构建错误的解决方法
2017-08-21 00:00
711 查看
摘要: npm run build
###错误代码
ERROR in ./src/app/base/environment.ts
Module build failed: TypeError: Cannot read property 'flags' of undefined
at Object.isExternalModuleSymbol (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:73503:40)
at getExportInfo (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77753:23)
at exportInfo (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77699:34)
at getExport (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77642:36)
at Object.getImportOrExportSymbol (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77613:53)
at getImportOrExportReferences (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78575:56)
at getReferencesAtLocation (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78516:17)
at getReferencesInContainer (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78470:21)
at getReferencedSymbolsForSymbol (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78137:21)
at Object.getReferencedSymbolsForNode (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78048:24)
at Object.getReferenceEntriesForNode (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77869:58)
at getSemanticDocumentHighlights (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:76624:57)
at Object.getDocumentHighlights (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:76613:20)
at Object.getDocumentHighlights (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:89401:42)
at NoUseBeforeDeclareWalker.validateUsageForVariable (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js:113:47)
at NoUseBeforeDeclareWalker.visitVariableDeclaration (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js:106:18)
at NoUseBeforeDeclareWalker.SyntaxWalker.visitNode (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/language/walker/syntaxWalker.js:502:22)
at NoUseBeforeDeclareWalker.ScopeAwareRuleWalker.visitNode (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js:58:36)
at /Users/liuping/cmsUseNg2/node_modules/tslint/lib/language/walker/syntaxWalker.js:523:63
at visitEachNode (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:15956:30)
###解决方法
执行如下命令
npm run build:prod
原因:环境变量改变了
###错误代码
ERROR in ./src/app/base/environment.ts
Module build failed: TypeError: Cannot read property 'flags' of undefined
at Object.isExternalModuleSymbol (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:73503:40)
at getExportInfo (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77753:23)
at exportInfo (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77699:34)
at getExport (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77642:36)
at Object.getImportOrExportSymbol (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77613:53)
at getImportOrExportReferences (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78575:56)
at getReferencesAtLocation (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78516:17)
at getReferencesInContainer (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78470:21)
at getReferencedSymbolsForSymbol (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78137:21)
at Object.getReferencedSymbolsForNode (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:78048:24)
at Object.getReferenceEntriesForNode (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:77869:58)
at getSemanticDocumentHighlights (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:76624:57)
at Object.getDocumentHighlights (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:76613:20)
at Object.getDocumentHighlights (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:89401:42)
at NoUseBeforeDeclareWalker.validateUsageForVariable (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js:113:47)
at NoUseBeforeDeclareWalker.visitVariableDeclaration (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/rules/noUseBeforeDeclareRule.js:106:18)
at NoUseBeforeDeclareWalker.SyntaxWalker.visitNode (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/language/walker/syntaxWalker.js:502:22)
at NoUseBeforeDeclareWalker.ScopeAwareRuleWalker.visitNode (/Users/liuping/cmsUseNg2/node_modules/tslint/lib/language/walker/scopeAwareRuleWalker.js:58:36)
at /Users/liuping/cmsUseNg2/node_modules/tslint/lib/language/walker/syntaxWalker.js:523:63
at visitEachNode (/Users/liuping/cmsUseNg2/node_modules/typescript/lib/typescript.js:15956:30)
###解决方法
执行如下命令
npm run build:prod
原因:环境变量改变了
相关文章推荐
- 基于vue-cli npm run build之后vendor.js文件过大的解决方法
- caffe训练cifar10遇到./build/tools/caffe: not found 错误解决方法
- Flex builder中的An internal build error has occurred错误解决方法
- vue-cli构建项目 npm run build后应该怎么运行在本地查看效果
- Maven构建过程中报“非法字符: \65279 ”错误的解决方法
- 在win7 64上用npm安装phantomjs时出现Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE错误的解决方法。
- Myeclipse错误:Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project ...解决方法
- VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法
- 运行时出现Run-time error'429'错误的解决方法
- 解决Vue-cli npm run build生产环境打包,本地不能打开的问题
- svn: Previous operation has not finished; run 'cleanup' if it was interrupted错误彻底解决方法
- maven项目构建出现Unknown lifecycle phase "build".提示解决方法
- Ubuntu上运行Chrome出现“Google Chrome can not be run as root”错误的解决方法
- Flash Build 4编译慢、报java heap space 堆空间异常错误的解决方法
- LR错误: Commands out of sync; you can't run this command now 解决方法
- 项目常见错误及解决方法-angular提示控制器未注册
- php安装 出现Sorry, I cannot run apxs. ***错误解决方法
- vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法
- 非OpenGL版本的Qt使用QGLWidget构建OPenGL应用须知与编译错误解决方法
- vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法