Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm broken under windows (v2.2.1 and v2.2.2 nightly) #1940

Closed
lucidogen opened this issue Jun 10, 2015 · 7 comments
Closed

npm broken under windows (v2.2.1 and v2.2.2 nightly) #1940

lucidogen opened this issue Jun 10, 2015 · 7 comments
Labels
npm Issues and PRs related to the npm client dependency or the npm registry. windows Issues and PRs related to the Windows platform.

Comments

@lucidogen
Copy link

Is it just me or is iojs broken on Windows ?

When I install a global module, it gets installed in HOME/AppData/Roaming/npm/node_modules but this path is not searched in Module.require (see below).

Shouldn't global modules be installed in Program Files/lib/node ?

    $ which npm
    /c/Program Files/iojs/npm

    $ which node
    /c/Program Files/iojs/node

    $ npm install -g is-property
    is-property@1.0.2 C:\Users\gaspard\AppData\Roaming\npm\node_modules\is-property

    $ node
    > require('module')
    { [Function: Module]
      _contextLoad: false,
      _cache: {},
      _pathCache: {},
      _extensions:
       { '.js': [Function],
         '.json': [Function],
         '.node': [Function: dlopen] },
      globalPaths:
       [ 'C:\\Users\\gaspard\\.node_modules',
         'C:\\Users\\gaspard\\.node_libraries',
         'c:\\Program Files\\lib\\node' ],
@brendanashworth brendanashworth added windows Issues and PRs related to the Windows platform. npm Issues and PRs related to the npm client dependency or the npm registry. labels Jun 10, 2015
@v12
Copy link

v12 commented Jun 10, 2015

This is absolutely normal behavior. AFAIR, global modules have always been installed into %AppData%\npm on WIndows and never been accessible from scripts.

@lucidogen
Copy link
Author

What is the point of installing global modules if they are not accessible with "require" ? This behavior is different from the what npm does on Mac OS X, why have different behavior on different platforms ?

@v12
Copy link

v12 commented Jun 10, 2015

The point is to be able to install, for instance, system-wide command-line applications like PM2 or Bower.

And I'm afraid to disappoint you but such behavior is identical on all platforms. Global modules are not accessible in scripts neither on Windows nor on Mac OS.

@Trott
Copy link
Member

Trott commented Jun 11, 2015

I'm seeing this same behavior on OS X. I am seeing it on Node v0.10.36 as well as io.js, so I don't think it's a bug.

But that last path under globalPaths sure is curious and one could be forgiven for thinking something is amiss. In that regard, I'm seeing the same thing as @lucidogen and that path does not exist. But even more curious, if I change the last component of that path from node to node_modules, that path does exist and it is where my global modules are installed.

I haven't bothered (yet, at least) looking in to how and why that last path gets set, but one can certainly be forgiven for thinking it's a probable bug.

@lucidogen
Copy link
Author

Sorry for the noise and my misunderstanding. It is good to know that global modules are not seen by scripts as this global installation "feature" of other packaging systems is a nightmare. Happy to see that this behaviour is consistent across platforms. I am closing this now. @Trott if this path thing is a bug, please open another issue.

@Trott
Copy link
Member

Trott commented Jun 11, 2015

Looking at the code, I do think this is actually a bug. I'll open a separate ticket.

@Trott
Copy link
Member

Trott commented Jun 11, 2015

Opened #1946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
npm Issues and PRs related to the npm client dependency or the npm registry. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

3 participants