为什么当我想要ng-build--prod这个问题显示出来



中的错误/node_modules/ng2-pdf-viewer/fesm5/ng2-pdf-viewer.js模块构建失败(来自./node_modules/@angular devkit/build optimizer/src/build optimizer/webpack loader.js(:TypeError:无法读取未定义的属性"kind"位于isAngularDecoratorMetadataExpression(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\src\transforms\scrub file.js:265:35(在checkNodeForDecorators(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\src\transforms\scrub file.js:77:21(访问节点(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16144:30(在Object.forEachChild(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16370:24(在checkNodeForDecorators(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\src\transforms\scrub file.js:68:31(访问节点(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16135:24(在Object.forEachChild(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16265:21(在checkNodeForDecorators(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\src\transforms\scrub file.js:68:31(访问节点(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16135:24(在Object.forEachChild(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:1632:24(在checkNodeForDecorators(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\src\transforms\scrub file.js:68:31(访问节点(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16135:24(在Object.forEachChild(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:1633:24(在checkNodeForDecorators(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\src\transforms\scrub file.js:68:31(访问节点(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:16135:24(在Object.forEachChild(E:\Mohamed Mostafa Work\new_project\reservation\node_modules@angular-devkit\构建优化器\node_modules\typescript\lib\typescript.js:1629:21(

我得到了同样的错误,但最终用以下解决方案解决了。。Unistall ng2 pdf查看器优先然后安装-npm安装ng2-pdf-viewer@5.3.4

将angular.json中的以下属性设置为false为我解决了问题:

";buildOptimizer":false

从根文件夹中删除package-lock.json编辑package.json并将ng2 pdf查看器版本更改为以下

"ng2-pdf-viewer": "5.3.4"

低于命令运行

npm install
npm build --prod 

它应该解决问题

经过长时间的搜索,这对我有效。

将@angular devkit/build angular升级到版本:"~0.803.19",然后prod-build运行良好。在package.json.中进行了以下更改

"devDependencies": {
"@angular-devkit/build-angular": "~0.803.19",
...
}

这适用于ng2pdfviewer:6.3.0&角度8.3.19

希望这能有所帮助!

请将您的angular devkit依赖项更改为包中的最新版本。josn文件:

我在下面的依赖项中更改了版本,它与--prod命令一起使用

"devDependencies": { "@angular-devkit/architect": "~0.803.20", "@angular-devkit/build-angular": "~0.803.20", "@angular-devkit/core": "~8.3.20", "@angular-devkit/schematics": "~8.3.20", }

这个解决方案像魅力一样工作:(

导航到您的应用程序文件夹并首先运行npm i命令,您似乎错过了十几个包

尝试删除node_modules文件夹,然后运行npm i

较低版本的ng2 pdf查看器适用于我的

相关内容

  • 没有找到相关文章

最新更新