gpt4 book ai didi

node.js - 从 Angular 6 迁移到 Angular 7 导致错误 - 无法解析 'core-js/es7/reflect'

转载 作者:太空狗 更新时间:2023-10-29 18:05:29 25 4
gpt4 key购买 nike

Global Angular CLI: 7.3.8
Node v10.15.3
NPM 6.4.1
macos

我在 npm start 上遇到这个错误

ERROR in ./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js Module not found: Error: Can't resolve 'core-js/es7/reflect' in '/Users/XXX/projects/XXX/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models' ERROR in ./src/polyfills.ts Module not found: Error: Can't resolve 'core-js/es7/reflect' in '/Users/XXX/projects/XXX/src'

最佳答案

为了解决这个问题,我在 tsconfig.json 的 compilerOptions 中添加了以下路径

{
"compileOnSave": false,
"compilerOptions": {
"paths": {
"core-js/es7/reflect": [
"node_modules/core-js/proposals/reflect-metadata",
],
"core-js/es6/*": ["node_modules/core-js/es"]
},
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}

关于node.js - 从 Angular 6 迁移到 Angular 7 导致错误 - 无法解析 'core-js/es7/reflect',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55752755/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com