I want to use require('foo')
but I have to require('poolee')
. Is there a correct way to alias it in package.json
? I don't want to use the git project name as the module name.
Created
January 8, 2015 02:46
-
-
Save dannycoates/318489afd83359501ec6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "wat", | |
"version": "1.0.0", | |
"dependencies": { | |
"foo": "git://github.com/dannycoates/poolee.git" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
marceline:wat dcoates$ npm install | |
npm WARN package.json [email protected] No description | |
npm WARN package.json [email protected] No repository field. | |
npm WARN package.json [email protected] No README data | |
[email protected] node_modules/poolee | |
└── [email protected] | |
marceline:wat dcoates$ npm ls | |
[email protected] /Users/dcoates/code/wat | |
├── UNMET DEPENDENCY foo@git://github.com/dannycoates/poolee.git | |
└── [email protected] extraneous (git://github.com/dannycoates/poolee.git#c0f7d2e5e0dc7cd5999331f36b8176a8ac1c5dc0) | |
npm ERR! missing: foo@git://github.com/dannycoates/poolee.git, required by [email protected] | |
npm ERR! extraneous: [email protected] /Users/dcoates/code/wat/node_modules/poolee | |
marceline:wat dcoates$ tree | |
. | |
├── node_modules | |
│ └── poolee | |
│ ├── LICENSE | |
│ ├── index.js | |
│ ├── lib | |
│ │ ├── endpoint.js | |
│ │ ├── error.js | |
│ │ ├── pinger.js | |
│ │ ├── pool.js | |
│ │ └── request_set.js | |
│ ├── node_modules | |
│ │ └── keep-alive-agent | |
│ │ ├── LICENSE | |
│ │ ├── README.md | |
│ │ ├── index.js | |
│ │ ├── package.json | |
│ │ └── test | |
│ │ └── test.js | |
│ ├── package.json | |
│ ├── readme.md | |
│ └── test | |
│ ├── endpoint_test.js | |
│ ├── integration_test.js | |
│ ├── pool_test.js | |
│ └── requestset_test.js | |
└── package.json | |
marceline:wat dcoates$ node | |
> require('foo') | |
Error: Cannot find module 'foo' | |
at Function.Module._resolveFilename (module.js:338:15) | |
at Function.Module._load (module.js:280:25) | |
at Module.require (module.js:364:17) | |
at require (module.js:380:17) | |
at repl:1:2 | |
at REPLServer.self.eval (repl.js:110:21) | |
at Interface.<anonymous> (repl.js:239:12) | |
at Interface.emit (events.js:95:17) | |
at Interface._onLine (readline.js:203:10) | |
at Interface._line (readline.js:532:8) | |
> require('poolee') | |
{ [Function: Pool] | |
super_: { [Function: EventEmitter] listenerCount: [Function] } } | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The package manifest determines the name of the installed package, so what you're trying to do won't work, by design. There are a bunch of issues filed on npm that describe why this is the case, but the short answer is that it's safer and less confusing overall.