在Angular Production构建期间出错

时间:2018-07-06 19:50:12

标签: javascript node.js angular build production

当我准备发布项目时,出现此错误。有人可以告诉我该如何解决?

ERROR in ./node_modules/angular2-jwt/angular2-jwt.js                                                   
Module build failed: Error: Debug Failure. False expression.                                           
    at getJSDocTags (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\build-optim
er\node_modules\typescript\lib\typescript.js:13197:22)                                                 
    at getFirstJSDocTag (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\build-o
imizer\node_modules\typescript\lib\typescript.js:13205:24)                                             
    at Object.getJSDocTypeTag (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\b
ld-optimizer\node_modules\typescript\lib\typescript.js:13154:19)                                       
    at checkParenthesizedExpression (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-de
it\build-optimizer\node_modules\typescript\lib\typescript.js:45628:56)                                 
    at checkExpressionWorker (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\bu
d-optimizer\node_modules\typescript\lib\typescript.js:45676:28)                                        
    at checkExpression (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\build-op
mizer\node_modules\typescript\lib\typescript.js:45609:42)                                              
    at checkBinaryLikeExpression (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devki
build-optimizer\node_modules\typescript\lib\typescript.js:45155:29)                                    
    at checkBinaryExpression (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\bu
d-optimizer\node_modules\typescript\lib\typescript.js:45147:20)                                        
    at checkExpressionWorker (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\bu
d-optimizer\node_modules\typescript\lib\typescript.js:45702:28)                                        
    at checkExpression (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\build-op
mizer\node_modules\typescript\lib\typescript.js:45609:42)                                              
    at checkExpressionCached (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\bu
d-optimizer\node_modules\typescript\lib\typescript.js:45457:38)                                        
    at getTypeOfExpression (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-devkit\buil
optimizer\node_modules\typescript\lib\typescript.js:45577:28)                                          
    at checkDeclarationInitializer (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angular-dev
t\build-optimizer\node_modules\typescript\lib\typescript.js:45469:24)                                  
    at getTypeForVariableLikeDeclaration (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@angul
-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30738:28)                            
    at getWidenedTypeForVariableLikeDeclaration (D:\Visual Studio\asp.net\mean_blog\client\node_modules
angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30961:24)                     
    at getTypeOfVariableOrParameterOrProperty (D:\Visual Studio\asp.net\mean_blog\client\node_modules\@
gular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:31062:28)                       
npm ERR! code ELIFECYCLE                                                                               
npm ERR! errno 1                                                                                       
npm ERR! blog@0.0.0 build: `cd client && ng build --prod && cd .. && node ./bin/www`                   
npm ERR! Exit status 1                                                                                 
npm ERR!                                                                                               
npm ERR! Failed at the blog@0.0.0 build script.                                                        
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.     

npm ERR! A complete log of this run can be found in:                                                   
npm ERR!     C:\Users\Yashdeep Raj\AppData\Roaming\npm-cache\_logs\2018-07-06T19_43_30_221Z-debug.log  

我已经修复了一些错误,但是这些是关于模块的,我对这些错误一无所知。

2 个答案:

答案 0 :(得分:0)

我使用@auth0/angular-jwt和angular 6解决了这个问题。您首先需要完全卸载angular2-jwt:

npm uninstall angular2-jwt --save

然后您可以运行:

npm install @auth0/angular-jwt

只有这两个命令行对我有所帮助。一切顺利。

答案 1 :(得分:-1)

我解决了这个问题,实际上我在使用angular2-jwt(Deprecated)和@ auth0 / angular-jwt。这是造成问题的原因。因此,我使用@ auth0 / angular-jwt卸载了angular2-jwt更新代码,一切正常。