Skip to content

How to require/import textbelt as a module? #121

Open
@daluu

Description

@daluu

Is the README outdated? Or an additional step needed, as in meant for node.js veterans and not novices?

On cloning repo, you can't just use as a module it seems, to a novice anyway. Following README, it's really vague on the steps other than code to invoke it when everything is set up right. Attempting to follow the instructions "as is" results in something like:

> var text = require('textbelt');
Error: Cannot find module 'textbelt'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at repl:1:12
    at REPLServer.defaultEval (repl.js:262:27)
    at bound (domain.js:287:14)
    at REPLServer.runBound [as eval] (domain.js:300:12)
    at REPLServer.<anonymous> (repl.js:431:12)
    at emitOne (events.js:82:20)

I'm actually more familiar with running the server version.

Now, we could use it with npm install, but it's not clear how best to do that, as I just used same repo and did symlink to itself under node_modules back to parent root and that didn't seem to work, trying to invoke it from a node shell in parent root.

One could however import/require by JS file by relative/absolute path to textbelt repo like:

> var text = require('./index.js');

and then use it the same way as the module import usage.

I did look up npm install of textbelt, but seems that repo for npm is separately maintained though:

https://www.npmjs.com/package/textbelt
https://github.com/ajay-gandhi/textbelt

although I see other variants on npm:

https://www.npmjs.com/package/mtextbelt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions