所以今天我想使用该命令创建一个新的 Angular 项目ng new <projectname>,但出现此错误:
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: project-name@0.0.0
npm ERR! Found: jasmine-core@3.6.0
npm ERR! node_modules/jasmine-core
npm ERR! dev jasmine-core@"~3.6.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.7.1" from karma-jasmine-html-reporter@1.6.0
npm ERR! node_modules/karma-jasmine-html-reporter
npm ERR! dev karma-jasmine-html-reporter@"^1.5.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用桶和tsconfigs paths选项导入一些服务,但我无法获得角度和vscode相处.
如果它适用于一个它不适用于另一个,反之亦然......
我的情况似乎很简单:
src/app/services我有一个服务,它在index.ts中导出src/tsconfig.app.json就是这样:{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": [],
"baseUrl": ".",
"paths": {
"services": ["app/services"]
}
},
"exclude": [
"test.ts",
"**/*.spec.ts"
],
}
Run Code Online (Sandbox Code Playgroud)
和我的角度应用没有问题编译,但vscode不断给我的错误每次我试图从导入我的服务时间'services'给我[ts] Cannot find module 'services'.
为什么?
我正在使用typescript 3.1.6并在我的vscode设置中"typescript.tsdk": "C:/Users/myuser/AppData/Roaming/npm/node_modules/typescript/lib"(我也尝试保留默认设置,没有更改)
编辑:
如果我指定paths在./tsconfig.json无法启动src,vscode是幸福的,但角度不是.
如果我paths在两者中指定,tsconfig.json并且src/tsconfig.app.jsonvscode和angular都很高兴,但对我来说这似乎是一个太愚蠢的解决方法......
typescript tsconfig visual-studio-code vscode-settings angular