pid / speakingurl

Generate a slug – transliteration with a lot of options
http://pid.github.io/speakingurl/
BSD 3-Clause "New" or "Revised" License
1.12k stars 84 forks source link

index.js - has to add "./" to get it to work with npm/node #12

Closed kimptoc closed 11 years ago

kimptoc commented 11 years ago

Hi,

I did an "npm install speakingurl", but when I try to require it in the REPL, I get this:

$ npm install speakingurl                                                                                                                                       
npm http GET https://registry.npmjs.org/speakingurl
npm http GET https://registry.npmjs.org/speakingurl
npm http 200 https://registry.npmjs.org/speakingurl
npm http GET https://registry.npmjs.org/speakingurl/-/speakingurl-0.2.4.tgz
npm http 200 https://registry.npmjs.org/speakingurl/-/speakingurl-0.2.4.tgz
speakingurl@0.2.4 node_modules/speakingurl%                                                                                                                                                      kimptoc:node-scratch/ $ node                                                                                                                                                          
> slug=require("speakingurl")
Error: Cannot find module 'lib/'
    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 Object.<anonymous> (/Users/kimptoc/Dropbox/dev/tools/node-scratch/node_modules/speakingurl/index.js:1:80)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)

To fix this I changed speakingurl/index.js from:

module.exports = require('lib/');

to

module.exports = require('./lib/');

Would submit a PR, but not sure if this is the best way to fix this...

Regards, Chris

kimptoc commented 11 years ago

Thanks :)