Dependencies not installed in Visual Studio

2020-02-26 14:33发布

I'm currently upgrading my ASP.Net RC1 to ASP.Net Core RC2. The Solution Explorer in Visual Studio is giving me a warning of "Dependencies - not installed" with subfolder "npm - not installed".

However, the dependencies do seem to be installed - I ran 'npm install' in the project directory and it ran fine without any errors, just some warnings. It added the dependency folders into a parent folder called node-modules which I can see clearly in Windows Explorer. The node-modules folder contains folders for angular2, bootstrap, copy-webpack-plugin, etc.

Does anyone know why Visual Studio is telling me they aren't installed? I've also tried running npm install from Package Manager Console and doing a 'right-click -> restore packages' on those folders giving me the warning in the Solution Explorer.

enter image description here

Here's my package.json file:

{
  "name": "EmptyWebApp",
  "version": "0.0.0",
  "dependencies": {
    "angular2": "2.0.0-beta.13",
    "bootstrap": "^3.3.5",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.35.0",
    "reflect-metadata": "0.1.2",
    "jquery": "^2.1.4",
    "less": "^2.5.3",
    "lodash": "^3.10.1",
    "rxjs": "5.0.0-beta.2",
    "systemjs": "0.19.22",
    "ts-loader": "^0.7.2",
    "zone.js": "0.6.6"
  },
  "devDependencies": {
    "del": "^2.0.2",
    "event-stream": "^3.3.1",
    "copy-webpack-plugin": "^0.3.3",
    "css-loader": "^0.23.0",
    "exports-loader": "0.6.2",
    "expose-loader": "^0.7.1",
    "file-loader": "^0.8.4",
    "gulp": "^3.9.0",
    "html-webpack-plugin": "^1.7.0",
    "http-server": "^0.8.5",
    "imports-loader": "^0.6.4",
    "istanbul-instrumenter-loader": "^0.1.3",
    "json-loader": "^0.5.3",
    "nodemon":  "^1.8.1",
    "phantomjs": "^1.9.18",
    "phantomjs-polyfill": "0.0.1",
    "protractor": "^3.0.0",
    "raw-loader": "0.5.1",
    "reflect-metadata": "0.1.2",
    "remap-istanbul": "^0.5.1",
    "rimraf": "^2.4.4",
    "style-loader": "^0.13.0",
    "ts-helper": "0.0.1",
    "ts-loader": "^0.7.2",
    "tsconfig-lint": "^0.4.3",
    "tslint": "^3.2.0",
    "tslint-loader": "^2.1.0",
    "typedoc": "^0.3.12",
    "typescript": "1.8.9",
    "typings": "^0.6.1",
    "url-loader": "^0.5.6",
    "webpack": "^1.12.9",
    "webpack-dev-server": "^1.12.1",
    "webpack-md5-hash": "0.0.4"    
  },
  "scripts": {
    "tsc": "tsc -p . -w",
    "start": "nodemon --ignore htm,html --ext cs,js --exec \"dnx web\" -V",
    "static": "nodemon --watch ./client --ext html,css --exec \"gulp deploy-client\" -V",
    "pre-build": "gulp deploy-client",
    "webpack": "webpack",
    "webpack-watch": "webpack --watch",
    "clean": "gulp cleanwww",
    "build": "npm run pre-build && npm run webpack",
    "dnx": "dnx web"
  }
}

10条回答
该账号已被封号
2楼-- · 2020-02-26 15:33

I think this is known problem with RC2 reported in asp github

https://github.com/aspnet/Tooling/issues/479

I think the functionality should work but the message is wrong so probably we need to wait until they solve the problem.

查看更多
冷血范
3楼-- · 2020-02-26 15:36

Just copy and paste node-modules folder from nodejs folder to your visual studio, project root folder, and right click and restore packages inside VS . That will do the trick!

查看更多
叼着烟拽天下
4楼-- · 2020-02-26 15:39

I removed each item from the package.json file until the error stops appearing. In my case the error was caused by

    "grunt-ts": "5.5.1"

查看更多
疯言疯语
5楼-- · 2020-02-26 15:40

This is still an issue in Visual Studio Community 2015, Update 3 edition when creating an ASP.NET Core Web Application (.NET Framework 4.5.2) using the the Empty ASP.NET Core Template. It does appear to function properly when creating the project using the ASP.NET Core Web Application Template.

As the op mentioned the message is misleading since the dependencies are installed. It seems to be just a misreporting by Visual Studio that the npm and the dependencies are not installed. The temporary fix is to override where Visual Studio is looking for node.js, which removes the not installed messages in visual studio.

In Visual Studio go to Tools > Options > Projects and Solutions > External Web Tools and add a path to your installation of node.js. This is by default located at C:\Program Files\nodejs\ or C:\Program Files (x86)\nodejs\ Move this new line to the top or at least above the $(VSINSTALLDIR)\Web\External line.

enter image description here

Restore your packages and the error message should go away.

enter image description here

查看更多
登录 后发表回答