Angular 2中的Jasmine节点模块出错 [英] Error with jasmine node module in angular 2
问题描述
我收到以下错误,
- 我尝试过更改打字稿的版本,但这并不能解决问题.
-
我已经尝试运行
npm update --save
,但是还是没有有效.
[默认]/用户/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:37中的错误参数初始化程序仅在函数或构造函数实现中允许.
ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:37 A parameter initializer is only allowed in a function or constructor implementation.
[默认]/用户/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:45中的错误找不到名称"keyof".
ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:45 Cannot find name 'keyof'.
[默认]/用户/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:51中的错误预期为"=".
ERROR in [default] /Users/gdayton/Documents/auction/node_modules/@types/jasmine/index.d.ts:39:51 '=' expected.
这是我的package.json文件.
Here is my package.json file.
{
"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"
}
}
推荐答案
您对所有软件包运行快速更新,并使用更新的版本更新package.json文件,请按照以下步骤
You run a quick update for all packages and update the package.json file with updated versions, Follow these steps
- 删除 node_modules 文件夹.
- 从C:\ Users \ USERNAME \ AppData \ Roaming删除npm-cache
- 打开命令提示符,然后导航到应用程序的根文件夹.
-
使用命令
- Delete the node_modules folder.
- Delete npm-cache from C:\Users\USERNAME\AppData\Roaming
- Open command prompt and navigate to root folder of your application.
Check for the updates in npm packages using the command
npm-check-updates -u
更新所有软件包,并使用命令将package.json修改为当前版本
Update all the packages and modify your package.json to current version using the command
npm update --save
另外,使用命令
npm install -g npm-check-updates
希望这可以解决您的问题,如果不能让我知道.
Hope this must fix your problem, if not let me know.
这篇关于Angular 2中的Jasmine节点模块出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!