可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Earlier I was working with Angular2.3.1 and just updated package.json file using npm update --save to get updated version of Angular2 which is 2.4.7.
But it seems, for some reason, its breaking the code when I do npm start.
Its says
node_modules/@types/jasmine/index.d.ts(39,52): error TS1005: '=' expected
Now, I wonder how to fix it?
Any idea?
回答1:
After searching in google, came to know that latest version 2.5.43 of @types/jasmine
is not compatible with typescript version 2.0.*
.
So had to upgrade typescript to 2.1.6
.
Read more here: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14569
回答2:
As mentioned on Github you should downgrade your jasmine version for now.
In you package.json replace the current dependency with:
"@types/jasmine": "2.5.38"
After that run and NPM update in you command line
$ npm update
That's it your done, compilation errors should disappear.
回答3:
Make sure local TypeScript version is "2.1.6". In my case global TypeScript version was 2.2.1 and local version was 2.0.3. I changed local version for TypeScript (in package.json) to "2.1.6" and it worked fine.