npm > 2.7.5:"prefer global" warning causes failure "Command executed with exception"

saper's Avatar


25 Jun, 2015 10:25 AM

We are getting build failures caused by "prefer global" flag in the jshint package:

npm : npm WARN prefer global jshint@2.8.0 should be installed with -g  
At line:1 char:1  
+ npm install --msvs_version=2013
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (npm WARN prefer...stalled with -g:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

kolor@1.1.6 node_modules\kolor  
jshint@2.8.0 node_modules\jshint  
Γö£ΓöÇΓöÇ strip-json-comments@1.0.2  
Γö£ΓöÇΓöÇ exit@0.1.2  
Γö£ΓöÇΓöÇ console-browserify@1.1.0 (date-now@0.1.4)  
Γö£ΓöÇΓöÇ shelljs@0.3.0  
Γö£ΓöÇΓöÇ minimatch@2.0.8 (brace-expansion@1.1.0)  
Γö£ΓöÇΓöÇ cli@0.6.6 (glob@3.2.11)  
Γö£ΓöÇΓöÇ htmlparser2@3.8.3 (domelementtype@1.3.0, entities@1.0.0, domhandler@2.3.0, readable-stream@1.1.13, domutils@1.5.1)  
ΓööΓöÇΓöÇ lodash@3.7.0  
Command executed with exception: npm WARN prefer global jshint@2.8.0 should be installed with -g

We have filed this bug also with npm:

So npm 2.7.4 works fine, npm > 2.7.5 fails.

Here are examples of the test project builds:

npm 2.10.1 with node 0.12.4:

npm 2.8.3 with iojs 1.8.1:

But npm 1.4.28 with node 0.10 works:

It might be an npm problem, but we are unable to reproduce this locally - our project builds fine also with newer npms locally, so there may be something special in the AppVeyor environment that causes this failure.

Mini test project can be checked out at:

  1. Support Staff 1 Posted by Feodor Fitsner on 25 Jun, 2015 10:43 PM

    Feodor Fitsner's Avatar

    Do not run npm install command as PowerShell. Remove ps: in this line:

  2. 2 Posted by saper on 07 Jul, 2015 01:35 AM

    saper's Avatar

    I have submitted to npm, this should fix that PowerShell issue.

    Any feedback welcome!

  3. Support Staff 3 Posted by Feodor Fitsner on 07 Jul, 2015 02:03 AM

    Feodor Fitsner's Avatar

    Thank you!

    - Feodor

  4. 4 Posted by saper on 28 Aug, 2015 10:02 AM

    saper's Avatar

    The fix for this is now part of npm 2.14.2. npm still prints some things to stderr sometimes (like warning about failed optional dependency), but this particular issue has been solved.

  5. saper closed this discussion on 28 Aug, 2015 10:02 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac