在 angular 13 上构建我的应用程序时出现一些问题
Some problem with build my application on angular 13
我试图找到解决这个问题的方法...
因为,不在我的代码上......
它是在更新到最新的 npm 和 fs-extra 之后...
Build at: 2022-03-16T13:33:13.718Z - Hash: aeac85e5815ce0c4 - Time: 7748ms
Error: node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.d.ts:26:121 - error TS2307: Cannot find module '../../.
./core/src' or its corresponding type declarations.
26 declare const _default: import("@angular-devkit/architect/src/internal").Builder<WebpackDevServerBuilderSchema & import("../../../core/src").JsonObject>;
~~~~~~~~~~~~~~~~~~~
Error: node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/build-webpack/src/webpack/index.d.ts:30:116 - error TS2307: Cannot find module '../../../core/src'
or its corresponding type declarations.
30 declare const _default: import("@angular-devkit/architect/src/internal").Builder<RealWebpackBuilderSchema & import("../../../core/src").JsonObject>;
~~~~~~~~~~~~~~~~~~~
Error: node_modules/@angular-devkit/build-angular/node_modules/webpack-dev-middleware/types/index.d.ts:204:27 - error TS2694: Namespace '"fs"' has no exported member 'StatSyncFn
'.
204 statSync?: import("fs").StatSyncFn;
有人对此有类似的解决方案吗?...
我已经尝试重新安装 webpack-server,所有指示...
无事可做......我不明白为什么那不起作用......
如何进行...?
感谢我们的帮助...
这里是package.json
"name": "bonrefil",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.0.0",
"@angular/cdk": "^13.2.6",
"@angular/common": "~13.0.0",
"@angular/compiler": "~13.0.0",
"@angular/core": "~13.0.0",
"@angular/forms": "~13.0.0",
"@angular/material": "^13.2.6",
"@angular/platform-browser": "~13.0.0",
"@angular/platform-browser-dynamic": "~13.0.0",
"@angular/router": "~13.0.0",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.7.2",
"fs-extra": "^10.0.1",
"image-to-base64": "^2.2.0",
"jquery": "^3.6.0",
"popper.js": "^1.16.1",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"uuid": "^8.3.2",
"xdata": "^2.1.17",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^13.2.6",
"@angular-devkit/core": "^13.2.6",
"@angular/cli": "~13.0.3",
"@angular/compiler-cli": "~13.0.0",
"@nguniversal/builders": "^13.0.2",
"@types/jasmine": "~3.10.0",
"@types/jquery": "^3.5.9",
"@types/node": "^12.20.46",
"@types/uuid": "^8.3.4",
"@types/webpack-dev-server": "^4.7.2",
"bootstrapvalidator": "^0.5.4",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.3",
"webpack": "^5.70.0",
"webpack-dev-middleware": "^5.3.1",
"webpack-dev-server": "^4.7.4"
}
}
您需要更新您的@types/node 版本。如果您至少更新到 15.12.2,它现在应该可以工作:参见 https://app.renovatebot.com/package-diff?name=@types%2Fnode&from=13.13.5&to=15.12.2
我试图找到解决这个问题的方法... 因为,不在我的代码上...... 它是在更新到最新的 npm 和 fs-extra 之后...
Build at: 2022-03-16T13:33:13.718Z - Hash: aeac85e5815ce0c4 - Time: 7748ms
Error: node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.d.ts:26:121 - error TS2307: Cannot find module '../../.
./core/src' or its corresponding type declarations.
26 declare const _default: import("@angular-devkit/architect/src/internal").Builder<WebpackDevServerBuilderSchema & import("../../../core/src").JsonObject>;
~~~~~~~~~~~~~~~~~~~
Error: node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/build-webpack/src/webpack/index.d.ts:30:116 - error TS2307: Cannot find module '../../../core/src'
or its corresponding type declarations.
30 declare const _default: import("@angular-devkit/architect/src/internal").Builder<RealWebpackBuilderSchema & import("../../../core/src").JsonObject>;
~~~~~~~~~~~~~~~~~~~
Error: node_modules/@angular-devkit/build-angular/node_modules/webpack-dev-middleware/types/index.d.ts:204:27 - error TS2694: Namespace '"fs"' has no exported member 'StatSyncFn
'.
204 statSync?: import("fs").StatSyncFn;
有人对此有类似的解决方案吗?... 我已经尝试重新安装 webpack-server,所有指示... 无事可做......我不明白为什么那不起作用...... 如何进行...?
感谢我们的帮助...
这里是package.json
"name": "bonrefil",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular/animations": "~13.0.0",
"@angular/cdk": "^13.2.6",
"@angular/common": "~13.0.0",
"@angular/compiler": "~13.0.0",
"@angular/core": "~13.0.0",
"@angular/forms": "~13.0.0",
"@angular/material": "^13.2.6",
"@angular/platform-browser": "~13.0.0",
"@angular/platform-browser-dynamic": "~13.0.0",
"@angular/router": "~13.0.0",
"bootstrap": "^5.1.3",
"bootstrap-icons": "^1.7.2",
"fs-extra": "^10.0.1",
"image-to-base64": "^2.2.0",
"jquery": "^3.6.0",
"popper.js": "^1.16.1",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"uuid": "^8.3.2",
"xdata": "^2.1.17",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^13.2.6",
"@angular-devkit/core": "^13.2.6",
"@angular/cli": "~13.0.3",
"@angular/compiler-cli": "~13.0.0",
"@nguniversal/builders": "^13.0.2",
"@types/jasmine": "~3.10.0",
"@types/jquery": "^3.5.9",
"@types/node": "^12.20.46",
"@types/uuid": "^8.3.4",
"@types/webpack-dev-server": "^4.7.2",
"bootstrapvalidator": "^0.5.4",
"jasmine-core": "~3.10.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"typescript": "~4.4.3",
"webpack": "^5.70.0",
"webpack-dev-middleware": "^5.3.1",
"webpack-dev-server": "^4.7.4"
}
}
您需要更新您的@types/node 版本。如果您至少更新到 15.12.2,它现在应该可以工作:参见 https://app.renovatebot.com/package-diff?name=@types%2Fnode&from=13.13.5&to=15.12.2