我收到以下错误,
我尝试过npm update --save
,但仍然没有
的工作原理。
[默认]中的错误/Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:37 参数初始值设定项仅允许在函数或构造函数实现中使用。
[默认]中的错误/Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:45 找不到名称' keyof'。
[默认]中的错误/Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:51 ' ='预期
这是我的package.json文件。
{
"name": "auction2",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"angular-cli": "1.0.0-beta.16",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
答案 0 :(得分:1)
在Typescript 2.1中引入了{p>[默认]中的错误/Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:45找不到名称'keyof'。
keyof
,在package.json
我看到了Typescript 2.0.2
。我知道你提到过升级过的Typescript,但也许需要更新版本。
答案 1 :(得分:1)
您对所有软件包运行快速更新并使用更新的版本更新package.json文件,请执行以下步骤
使用命令
检查npm包中的更新npm-check-updates -u
使用命令
更新所有软件包并将package.json修改为当前版本npm update --save
此外,使用命令
全局更新npm包npm install -g npm-check-updates
希望这必须解决你的问题,如果不让我知道。