我已经升级到最新的稳定后node和npm,我试过npm install moment --save.它package.json使用^前缀保存条目.以前,它是一个~前缀.
npm?~和之间有什么区别^?我的项目是使用[Angular CLI] 1.2.6版生成的.
我可以编译项目,它工作正常,但我总是得到错误的vs代码告诉我找不到模块'@ angular/core'找不到模块'@ angular/router'找不到模块.....
我附上了我的tsconfig.json文件的内容,这对我来说真的很令人沮丧,花了2个小时来弄清楚出了什么问题,我还卸载并重新安装了vs代码它不起作用.
这是我的环境规范:
@angular/cli: 1.2.6
node: 6.9.1
os: win32 x64
@angular/animations: 4.3.4
@angular/common: 4.3.4
@angular/compiler: 4.3.4
@angular/core: 4.3.4
@angular/forms: 4.3.4
@angular/http: 4.3.4
@angular/platform-browser: 4.3.4
@angular/platform-browser-dynamic: 4.3.4
@angular/router: 4.3.4
@angular/cli: 1.2.6
@angular/compiler-cli: 4.3.4
@angular/language-service: 4.3.4
os:微软vs 10企业
项目根文件夹
.angular-cli.json
.editorconfig
.gitignore
.vscode
e2e
karma.conf.js
node_modules
package.json
protractor.conf.js
README.md
src
tsconfig.json
tslint.json
node_module文件夹
-@angular
--animations
--cli
--common
--compiler
--compiler-cli
--core
---@angular
---bundles
---core.d.ts
---core.metadata.json
---package.json
---public_api.d.ts
---README.md
---src
---testing
---testing.d.ts
---testing.metadata.json
--forms
--http
--language-service
--platform-browser
--platform-browser-dynamic
--router …在全新的 Angular 12 应用程序中运行单元测试时,我收到以下弃用警告:
(node:14940) [log4js-node-DEP0004] DeprecationWarning:模式 %d{DATE} 已被弃用,因为它在使用时会引起混乱。请改用 %d{DATETIME}。
why log4js提示"karma" depends on it。警告本身很清楚应该做什么,但缺少两个关键信息:
karma并用新语法替换已弃用的语法之外 - 我绝对不会这样做)。降级log4js到早期版本,不会输出警告,使用forceResolutions似乎不是一个好主意,特别是因为我发现了一些与其中的漏洞相关的github线程,尽管业力似乎没有受到影响。
问题:是否有可行的途径可以避免收到警告,或者“现在我们等待”(更新karma)是唯一的选择?
注意:我也在karma 的 repo上询问过。
unit-testing karma-runner karma-jasmine log4js-node angular-cli
我跑ng new在终端。我最终收到了 npm 错误
ng new在新文件夹中运行? Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: alexa-powell@0.0.0
npm ERR! Found: jasmine-core@3.7.1
npm ERR! node_modules/jasmine-core
npm ERR!   dev jasmine-core@"~3.7.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer jasmine-core@">=3.8" from karma-jasmine-html-reporter@1.7.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 …CREATE firstapp/package.json (1209 bytes)\nCREATE firstapp/README.md (1018 bytes)\nCREATE firstapp/tsconfig.json (783 bytes)\nCREATE firstapp/tslint.json (3185 bytes)\nCREATE firstapp/.editorconfig (274 bytes)\nCREATE firstapp/.gitignore (631 bytes)\nCREATE firstapp/.browserslistrc (703 bytes)\nCREATE firstapp/karma.conf.js (1425 bytes)\nCREATE firstapp/tsconfig.app.json (287 bytes)\nCREATE firstapp/tsconfig.spec.json (333 bytes)\nCREATE firstapp/src/favicon.ico (948 bytes)\nCREATE firstapp/src/index.html (294 bytes)\nCREATE firstapp/src/main.ts (372 bytes)\nCREATE firstapp/src/polyfills.ts (2830 bytes)\nCREATE firstapp/src/styles.css (80 bytes)\nCREATE firstapp/src/test.ts (753 bytes)\nCREATE firstapp/src/assets/.gitkeep (0 bytes)\nCREATE firstapp/src/environments/environment.prod.ts (51 bytes)\nCREATE firstapp/src/environments/environment.ts (662 bytes)\nCREATE firstapp/src/app/app-routing.module.ts (245 bytes)\nCREATE firstapp/src/app/app.module.ts (393 bytes)\nCREATE firstapp/src/app/app.component.html (24955 bytes)\nCREATE firstapp/src/app/app.component.spec.ts (1063 bytes)\nCREATE firstapp/src/app/app.component.ts (212 bytes)\nCREATE firstapp/src/app/app.component.css (0 bytes)\nCREATE firstapp/e2e/protractor.conf.js (904 bytes)\nCREATE firstapp/e2e/tsconfig.json …angular-cli ×3
node.js ×3
npm ×3
angular ×1
jasmine ×1
karma-runner ×1
log4js-node ×1
package.json ×1
unit-testing ×1