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

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

Open
daluu opened this issue Mar 20, 2018 · 2 comments
Open

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

daluu opened this issue Mar 20, 2018 · 2 comments

Comments

@daluu
Copy link
Collaborator

daluu commented Mar 20, 2018

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

@reelbeelveel
Copy link

@daluu did you ever solve this?

@daluu
Copy link
Collaborator Author

daluu commented Sep 1, 2020

Sorry for delayed response, no, and I've not followed up on it since, I don't really use textbelt myself these days. Would be nice if @typpo would offer some insight here.

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

No branches or pull requests

2 participants