Build: Cannot find type definition file for node

The community version of VS 2015 (at home), npm 3.10, Angular 2 Im trying to pull get Angular2 setup in an ASP.Net MVC 5 application. In the template, I started using an older version of Angular, so I updated the package links.

When I create the first error in the list:
Build: Cannot find type definition file for node
After that, there are dozens of other errors, but Im, assuming the majority, is connected with this first problem.

Here is the .json package and typings.json

package.json

{ "version": "1.0.0", "name": "aspnet", "private": true, "scripts": { "postinstall": "typings install", "typings": "typings" }, "dependencies": { "@angular/common": "~4.0.0", "@angular/compiler": "~4.0.0", "@angular/core": "~4.0.0", "@angular/forms": "~4.0.0", "@angular/http": "~4.0.0", "@angular/platform-browser": "~4.0.0", "@angular/platform-browser-dynamic": "~4.0.0", "@angular/router": "~4.0.0", "angular-in-memory-web-api": "~0.3.0", "systemjs": "0.19.40", "core-js": "^2.4.1", "rxjs": "5.0.1", "zone.js": "^0.8.4", "bootstrap": "^3.3.7" }, "devDependencies": { "@types/core-js": "^0.9.41", "gulp": "^3.9.1", "gulp-clean": "^0.3.2", "gulp-concat": "^2.6.1", "gulp-tsc": "^1.3.1", "gulp-typescript": "^3.1.6", "path": "^0.12.7", "typescript": "~2.1.0", "typings": "~2.1.1" } } 

typings.json

 { "globalDependencies": { "core-js": "registry:dt/core-js#0.0.0+20160725163759", "jasmine": "registry:dt/jasmine#2.2.0+20160621224255", "node": "registry:dt/node#6.0.0+20160909174046" } } 

If I try to update only typing, I get these messages

 *typings WARN deprecated 11/21/2016: "registry:dt/node#6.0.0+20160909174046" is deprecated (updated, replaced or removed) typings WARN deprecated 9/14/2016: "registry:dt/core-js#0.0.0+20160725163759" is deprecated (updated, replaced or removed) typings WARN deprecated 10/25/2016: "registry:dt/jasmine#2.2.0+20160621224255" is deprecated (updated, replaced or removed)* 

[ update ]
having cleaned my node_modules folder and then running npm install, clear everything again. This happens most often when I move the project folder to another location on my system.

+4
source share
3 answers

I had several problems updating packages through visual studio. From now on, I always update or add packages with powershell console.

Launch powershell and navigate to the folder where package.json is located, and then run "npm install". Reboot visual studio after installation is complete.

You can also try deleting the node_modules folder and then running "npm install"

Hope this solves your problems.

+2
source

In my case, I solved my problem. Hope this helps others.

 npm install @types/node --save 
+7
source

For local Visual Studio

If you start with a clean template, the assembly in VS functions will probably work!

Go to Dependencies > npm > Right Click> Restore Packages

Then try to build again.

For Visual Studio Team Services

  • Install node https://nodejs.org/en/download/
  • Restart the agent service (VSTS agent) if you are not using hosted agents.
  • Add build task to start npm installation
  • Click the menu icon next to "Work Folder" to select the location of the project.json file.

    enter the code here

+1
source

Source: https://habr.com/ru/post/1014384/


All Articles