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-lazy-mirror global command broken on Windows #14

Open
robatron opened this issue Apr 28, 2014 · 2 comments
Open

npm-lazy-mirror global command broken on Windows #14

robatron opened this issue Apr 28, 2014 · 2 comments

Comments

@robatron
Copy link
Contributor

$ npm-lazy-mirror

module.js:340
    throw err;
          ^
Error: Cannot find module 'c:\Users\rmcguir\AppData\Roaming\npm\node_modules\npm-lazy-mirror\lib\node_modules\npm-lazy-mirror\server.js'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
@robatron
Copy link
Contributor Author

Just checked; This appears to work on Linux, so this likely a Windows-specific issue. Looks like this issue has something to do with how y'all are constructing the absolute path to the bin script.

(Linux constructs from the system-level bin script, and Windows constructs from the package-level bin script.)

@robatron robatron changed the title Pathing issue with npm-lazy-mirror global command npm-lazy-mirror global command broken on Windows Apr 29, 2014
@robatron
Copy link
Contributor Author

Dug into this a bit more:

This is happening because on Unix, global binaries are a symlink from /usr/bin/$PACKAGE -> /usr/lib/node_modules/$PACKAGE/bin/$PACKAGE, so $DIR will be /usr/bin, but on Windows, it'll be $HOME/AppData/Roaming/npm/node_modules/npm-lazy-mirror/bin.

This means that on Unix, the bin command will (correctly) be

node /usr/bin/../lib/node_modules/npm-lazy-mirror/server.js

But on Windows, it will be

node $HOME/AppData/Roaming/npm/node_modules/npm-lazy-mirror/bin/../lib/node_modules/npm-lazy-mirror/server.js

Reference: npm-folders

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

No branches or pull requests

2 participants