Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

NPM optional package installation failure #479

Open
Kukkimonsuta opened this issue May 16, 2016 · 23 comments
Open

NPM optional package installation failure #479

Kukkimonsuta opened this issue May 16, 2016 · 23 comments

Comments

@Kukkimonsuta
Copy link

Kukkimonsuta commented May 16, 2016

Some packages (for instance webpack) have dependency on packages that are not supported on windows which causes NPM to print warning about it. VS interprets it as generic problem and says that packages are not installed even though in reality this warning should be ignored.

There is an issue about this at npm repo npm/npm#11632 , but meanwhile it would be nice if VS could just ignore these warnings since everything actually works as expected. Also note that I'm using 'leaked' RC2/Preview1 tooling, I'll report back whether this behaviour changed when the proper release is out.

screenshot 2016-05-16 11 19 45

Output while using tools packaged with VS tooling:

PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\npm.CMD" install
npm WARN install Couldn't install optional dependency: Unsupported

Output while using newer external tools:

Node v5.11.0
Npm v3.9.0

PATH=.\node_modules\.bin;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
"C:\Program Files\nodejs\npm.CMD" install
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
@Kukkimonsuta
Copy link
Author

Confirming that the problem is present in the official release.

@sayedihashimi
Copy link
Contributor

TFS: 224850
I've added this to our internal TFS, we will reply back here soon.

@Luigie
Copy link

Luigie commented Jun 17, 2016

@sayedihashimi: Any feedback on this issue?

@jods4
Copy link

jods4 commented Jun 17, 2016

@Luigie FWIW I think this is an issue in npm rather than VS but they don't seem eager to fix it. Maybe you should add your voice to this issue: npm/npm#11632

@Luigie
Copy link

Luigie commented Jun 17, 2016

I've a work around.

first installed nodejs versions
and installed nodejs

PM> node -v
v6.2.1
PM> npm -v
3.9.3
PM>

image

@Luigie
Copy link

Luigie commented Jun 17, 2016

the packages are loading now, but message remains

@thetanz-geoff
Copy link

I’m also encountering this problem.

My environment (note the issue occurs both with Visual Studio pointed to its own nodejs installation and pointed to my nodejs installation):

  • Visual Studio 2015 Update 3 (freshly updated)
  • .NET Core SDK 1.0 Preview 2
  • nodejs v6.2.2 (Visual Studio node v5.4.1)
  • npm v3.9.5 (Visual Studio npm v3.3.4)
  • Specific package: gulp-watch v4.3.5 thru current (even earlier versions not tested).

Steps to reproduce:

  1. Create a new ASP.NET Core Web Application (.NET Core).
  2. Pick the “Empty” template.
  3. Right-click on the Project and choose “Add New File”.
  4. Select “npm Configuration File” and leave it named package.json.
  5. Save the package.json file. Visual Studio will execute npm.CMD install.
  6. Add this line inside devDependencies { }:
    "gulp-watch": "^4.3.8"
    NB: I have tried versions 4.3.5 thru to ^4.3.8 with the same result.
  7. Save package.json. Visual Studio will again execute npm.CMD install.
  8. Visual Studio interprets the result of the npm install as a failure. Solution Explorer displays the following:
    image
  9. Even if you remove gulp-watch from package.json, you won’t be able to get Visual Studio to snap out of this state until you’ve manually deleted node_modules.
  10. Note that running npm install from the command line completes ok regardless of whether gulp-watch is referenced (verbose output confirms this), but Visual Studio still won’t update to recognise that the Dependencies and npm are okay.

Further notes:

  • As noted above, the issue as described occurs regardless of whether pointed at Visual Studio’s own nodejs installation, or my own nodejs installation.
  • If pointing at its own npm version, v3.3.4, Visual Studio’s execution of npm install reports this message when gulp-watch is present in the dependencies:
npm WARN install Couldn't install optional dependency: Unsupported

This appears related to fsevents, which I understand is iOS-specific. By running npm install -verbose in the same path, part of the output is a WARN (but it still completes with npm info ok):

npm http 304 https://registry.npmjs.org/fsevents
npm verb headers { date: 'Wed, 29 Jun 2016 14:30:24 GMT',
npm verb headers   via: '1.1 varnish',
npm verb headers   'cache-control': 'max-age=300',
npm verb headers   etag: '"1QUQVXJX81R6H9MW4OZDK8QZY"',
npm verb headers   age: '173',
npm verb headers   connection: 'keep-alive',
npm verb headers   'x-served-by': 'cache-akl6420-AKL',
npm verb headers   'x-cache': 'HIT',
npm verb headers   'x-cache-hits': '2',
npm verb headers   'x-timer': 'S1467210624.222315,VS0,VE0',
npm verb headers   vary: 'Accept-Encoding' }
npm verb etag https://registry.npmjs.org/fsevents from cache
npm verb get saving fsevents to C:\Users\Geoff\AppData\Roaming\npm-cache\registry.npmjs.org\fsevents\.cache.json
npm WARN install Couldn't install optional dependency: Unsupported
npm verb install Error: Unsupported
npm verb install     at checkPlatform (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\npm-install-checks\index.js:46:14)
npm verb install     at Array.<anonymous> (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\slide\lib\bind-actor.js:15:8)
npm verb install     at LOOP (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\slide\lib\chain.js:15:14)
npm verb install     at c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\slide\lib\chain.js:18:7
npm verb install     at checkEngine (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\npm-install-checks\index.js:25:10)
npm verb install     at Array.<anonymous> (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\slide\lib\bind-actor.js:15:8)
npm verb install     at LOOP (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\slide\lib\chain.js:15:14)
npm verb install     at chain (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\slide\lib\chain.js:20:5)
npm verb install     at module.exports.isInstallable (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\npm\lib\install\validate-args.js:26:3)
npm verb install     at resolveWithNewModule (c:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\node_modules\npm\lib\install\deps.js:408:12)
  • I can confirm that, as others have reported, the application still builds and runs OK. However it is alarming and disconcerting that Visual Studio incorrectly displays the state of the Dependencies in Solution Explorer, and it will cause developers to spend a lot of time trying to figure out what they’ve done wrong.
  • And as noted, it is the package “gulp-watch” which triggers this, out of all the packages I’m working with. The following packages which I am also using are not triggering the issue for me:
dependencies:
    "@angular/common": "2.0.0-rc.2",
    "@angular/compiler": "2.0.0-rc.2",
    "@angular/core": "2.0.0-rc.2",
    "@angular/http": "2.0.0-rc.2",
    "@angular/platform-browser": "2.0.0-rc.2",
    "@angular/platform-browser-dynamic": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.2",
    "angular2-in-memory-web-api": "0.0.12",
    "body-parser": "1.15.2",
    "bootstrap": "3.3.6",
    "es6-shim": "0.35.1",
    "fancybox": "3.0.0",
    "jquery": "3.0.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.31",
    "zone.js": "0.6.12"
devDependencies:
    "del": "2.2.1",
    "gulp": "3.9.1",
    "gulp-typescript": "2.13.6",
    "merge": "1.2.0",
    "typescript": "1.8.10",
    "typings": "1.3.1"

As you'll have understood from my repointing of VS to my own nodejs installation, the fix proposed by Luigie does not resolve the issue for me.

Looking forward to any resolution which you can provide for this matter.
Thanks
-Geoff.

@Kukkimonsuta
Copy link
Author

Kukkimonsuta commented Aug 11, 2016

I've tried to workaround this problem by using script wrapping npm and appending --no-optional to npm install and grepping UNMET OPTIONAL DEPENDENCY message from npm ls, but it seems that VS is traversing the dependency tree without using npm and these warnings don't matter. So far the only workaround I've found is to open node_modules/chokidar/package.json after npm install (or any other package with missing optional dependency) and remove the optional package from dependencies and optionalDependencies.

I can sleep relatively well now, knowing VS is not yelling at me that I'm missing something.

@RamKesari
Copy link

Whenever I start my visual studio dot net project it again starts loading the package files due to which slowness occurs while loading the project. Is there is any work around ?

@duongthaiha
Copy link

Any update on this issue please? Npm download the packages however still showing not installed as mentioned above

@alienlike
Copy link

To echo @Kukkimonsuta, I created a .npmrc in my project root with the following contents:

optional = "false"
loglevel = "error"

This didn't fix anything. The only solution was to remove any reference to fsevents from node_modules/chokidar/package.json. I'm using VS 2015 Update 3 with .NET Core 1.0.1 Tooling Preview 2.

@lokap
Copy link

lokap commented Oct 20, 2016

I have fixed the issue like this:

Installed the latest version of npm: npm install -g npm@next
Added C:\Users\AppData\Roaming\npm to Windows' PATH. This must be placed before C:\Program Files\nodejs.

@amithegde
Copy link

amithegde commented Feb 5, 2017

@lokap adding C:\Users\AppData\Roaming\npm to PATH doesn't fix it.

@PaulKGray
Copy link

Any fix for this still seems to be an issue

PM> node -v
v7.5.0
PM> npm -v
4.1.2
PM>

@skorunka
Copy link

Got the same problem.

@ghost
Copy link

ghost commented Feb 20, 2017

Yep I too get have the same issue; very annoying! I guess one could write a script to always uninstall the fsevents package.

@ghost
Copy link

ghost commented Feb 20, 2017

You can globally set optional to false when installing packages through NPM. "npm set optional=false". This eliminated the warning from the "Bower/npm" output in visual studio but I still get dependencies - not installed. If you search for "not installed" in the solution explorer, it will display "fsevents - not installed" for "chokidar". Still is starting to piss me off!

@galmok
Copy link

galmok commented Mar 10, 2017

In no way should we have to resort to tampering with npm, node, or messing with the individual packages.
I feel this is a missing feature in package.json.

Issue on the npm project.

@DOMZE
Copy link

DOMZE commented Mar 11, 2017

Upgrade to Visual Studio 2017. no problem on that end now! 👍

@eagle-one78
Copy link

eagle-one78 commented Mar 24, 2017

My problem was one of the packages that stopped all other packages from loading, the best way to see if all your packages that work is to start the command line interface "CMD" and navigate to your project -> Type:

npm install

and you will see if all your packets go through the installation without problems.

The package I had problems with the

Webpack "Webpack": "^ 1:12:14"

I had to uninstall it with Package Installer tool. just right click and uninstall package.
The NodeJS dependencies error disapeard immediately after. Reinstall your package by running:

npm install packagename

@jimmymain
Copy link

jimmymain commented Dec 13, 2017

I am having this issue with the latest version of Visual Studio 2017 (15.5.1).
Node: 8.9.1
NPM: 5.5.1

image

Noty is installed in node_modules.

image

Does anyone know what steps visual studio takes to determine whether or not a package is installed. There's obviously something about Noty that is causing this?

I will raise a Noty issue if I can figure out what it's not displaying correctly, but I think it's a studio problem. The package is installed.

@Kukkimonsuta
Copy link
Author

@jimmymain Have you tried turning it off and on again? I've just created empty mvc project in VS 15.5.1 and it works fine.
noty

I can also confirm that missing optional dependencies no longer cause this behavior, so the issue can be probably closed. @sayedihashimi

@jimmymain
Copy link

jimmymain commented Dec 14, 2017

mmmh odd. I tried a few things... then I erased all the code, fetched clean from TFS, and rebuilt from scratch.
It's working now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests