Closed mrbinky3000 closed 10 years ago
Can you provide any additional info on your setup? I just validated that a new install is working properly on OSX Mavericks via Homebrew:
$ node --version
v0.10.31
$ npm --version
1.4.25
$ npm info tumblr.js
{ name: 'tumblr.js',
description: 'Official JavaScript client for the Tumblr API',
'dist-tags': { latest: '0.0.4' },
versions:
[ '0.0.1',
'0.0.2',
'0.0.3',
'0.0.4' ],
maintainers: 'seejohnrun <john.crepezzi@gmail.com>',
time:
{ modified: '2013-03-05T07:10:55.647Z',
created: '2013-02-19T19:42:31.725Z',
'0.0.1': '2013-02-19T19:42:35.182Z',
'0.0.2': '2013-02-19T21:17:48.492Z',
'0.0.3': '2013-02-19T22:23:00.444Z',
'0.0.4': '2013-03-05T07:10:55.647Z' },
author: 'Tumblr',
repository: { url: 'https://github.com/tumblr/tumblr.js' },
contributors:
[ 'Bryan Irace <bryan.irace@gmail.com>',
'John Crepezzi <john.crepezzi@gmail.com>' ],
homepage: 'https://github.com/tumblr/tumblr.js',
version: '0.0.4',
browserify: 'browser/index.js',
bin: { tumblr: './bin/repl.js' },
main: './index',
dependencies: { request: '2.12.0' },
devDependencies: { mocha: '*', should: '*' },
optionalDependencies: {},
engines: { node: '*' },
scripts: { test: 'mocha -r should test/*_spec.js' },
dist:
{ shasum: '57f8bc3d2315b45302ba10c2170b5c300aef478c',
tarball: 'http://registry.npmjs.org/tumblr.js/-/tumblr.js-0.0.4.tgz' },
directories: {} }
$ node
> var tumblr = require('tumblr.js')
undefined
> tumblr
{ Client: [Function: TumblrClient],
createClient: [Function],
request: [Function] }
I apologize. The name of my issue is misleading. Yes, I can install the package, but I can't reference the module using require(); Generally, people reference modules without the .js extension. If you include the .js extension, it implies you are looking for a single file called "tumblr.js" directly in the node_modules directory.
I don't know if this is standardized in documentation yet, but I've yet to see a module named with a file extension. It's a fringe case at best. You should really rename it to something else.
require('tumblr');
// looks for module node_modules/tumblr
require('tumblr.js');
// looks for a file node_modules/tumblr.js
This is what I get. (yes I know I'm using bleeding edge npm)
➜ example git:(dev) ✗ node --version
v0.10.29
➜ example git:(dev) ✗ npm --version
1.5.0-alpha-4
➜ example git:(dev) ✗ npm info tumblr.js
{ name: 'tumblr.js',
description: 'Official JavaScript client for the Tumblr API',
'dist-tags': { latest: '0.0.4' },
versions:
[ '0.0.1',
'0.0.2',
'0.0.3',
'0.0.4' ],
maintainers: 'seejohnrun <john.crepezzi@gmail.com>',
time:
{ modified: '2013-03-05T07:10:55.647Z',
created: '2013-02-19T19:42:31.725Z',
'0.0.1': '2013-02-19T19:42:35.182Z',
'0.0.2': '2013-02-19T21:17:48.492Z',
'0.0.3': '2013-02-19T22:23:00.444Z',
'0.0.4': '2013-03-05T07:10:55.647Z' },
author: 'Tumblr',
repository: { url: 'https://github.com/tumblr/tumblr.js' },
contributors:
[ 'Bryan Irace <bryan.irace@gmail.com>',
'John Crepezzi <john.crepezzi@gmail.com>' ],
homepage: 'https://github.com/tumblr/tumblr.js',
version: '0.0.4',
browserify: 'browser/index.js',
bin: { tumblr: './bin/repl.js' },
main: './index',
dependencies: { request: '2.12.0' },
devDependencies: { mocha: '*', should: '*' },
optionalDependencies: {},
engines: { node: '*' },
scripts: { test: 'mocha -r should test/*_spec.js' },
dist:
{ shasum: '57f8bc3d2315b45302ba10c2170b5c300aef478c',
tarball: 'http://registry.npmjs.org/tumblr.js/-/tumblr.js-0.0.4.tgz' },
directories: {} }
➜ example git:(dev) ✗ node
> var tumblr = require('tumblr.js');
Error: Cannot find module 'tumblr.js'
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:14
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
>
This section of the NPM site explains it better than I can: https://www.npmjs.org/doc/misc/npm-faq.html#what-is-a-module-
Notice how they say that files with an extension are resolved as relative paths to a specific file, not a module..
Hey @mrbinky3000 ,
I ran a similar set of commands that you posted above:
And I didn't encounter any issues.
$ node
> var tumblr = require('tumblr.js');
undefined
> var client = tumblr.createClient({
... consumer_key: consumerKey,
... consumer_secret: consumerSecret,
... token: oauthToken,
... token_secret: oauthSecret
... });
undefined
> client.blogInfo('rollingstone', function(err, data) { console.log(err, data) });
undefined
> null { blog:
{ title: 'Rolling Stone',
name: 'rollingstone',
posts: 4635,
url: 'http://rollingstone.tumblr.com/',
updated: 1410368686,
description: 'The official Tumblr of <br><a href="http://www.rollingstone.com">Rolling Stone Magazine</a>.',
is_nsfw: false,
ask: true,
ask_page_title: 'Ask me anything',
ask_anon: true,
followed: false,
can_send_fan_mail: true,
share_likes: true,
likes: 29 } }
I understand your concern that the module name is a bit mis-leading in regards to its path, but it doesn't break any functionality w/ npm, node, or the Tumblr client.
Please let me know if I missed the issue otherwise I think this should be closed.
What version of Node and NPM are you using? I suspect I'm using a newer version of NPM than you because, I stated above, it DOES break functionality and does not work on a Mac. Please check your version.
Node and NPM are relatively new technologies still maturing, and this change seems to be coming down the pipeline. Better to follow conventions set by other package names and change it now before it breaks for everyone when they update NPM.
$ node -v
v0.10.31
$ npm -v
1.4.26
You can't name a node module with a '.js' in the name.
When I do require('tumblr.js') it strips the .js and looks for 'tumblr' which someone else already wrote.
Change the name to 'tumblrjs' or something along those lines.