Discussion:
[nodejs] Problem accessing a package
Blaine Simpson
2018-07-02 02:20:10 UTC
Permalink
I'm new to Node.js. My Node.js installation doesn't support the import
command, but require has been working fine for me so far. But require
isn't working to give me access to the prettyprint
package https://www.npmjs.com/package/prettyprint after I install it with
npm.

Since I can't use require as suggested in the docs, I'm using

const prettyprint = require("prettyprint");

but I get 'TypeError: prettyprint is not a function'. Looking into that, I
see that after the require runs, prettyprint is an object with keys
'createvalueindes' and 'default'. What am I doing wrong?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/b63d482d-4106-4cd7-8209-aeca8b793f69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Paul Spaulding
2018-07-02 14:06:33 UTC
Permalink
const prettyprint = require("prettyprint").default;
Post by Blaine Simpson
I'm new to Node.js. My Node.js installation doesn't support the import
command, but require has been working fine for me so far. But require
isn't working to give me access to the prettyprint package
https://www.npmjs.com/package/prettyprint after I install it with npm.
Since I can't use require as suggested in the docs, I'm using
const prettyprint = require("prettyprint");
but I get 'TypeError: prettyprint is not a function'. Looking into that,
I see that after the require runs, prettyprint is an object with keys
'createvalueindes' and 'default'. What am I doing wrong?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/dc068bfe-7c7f-4154-a75c-261567c39d61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Blaine Simpson
2018-07-02 15:24:01 UTC
Permalink
Resolved. Ty!
Post by Paul Spaulding
const prettyprint = require("prettyprint").default;
Post by Blaine Simpson
I'm new to Node.js. My Node.js installation doesn't support the import
command, but require has been working fine for me so far. But require
isn't working to give me access to the prettyprint package
https://www.npmjs.com/package/prettyprint after I install it with npm.
Since I can't use require as suggested in the docs, I'm using
const prettyprint = require("prettyprint");
but I get 'TypeError: prettyprint is not a function'. Looking into that,
I see that after the require runs, prettyprint is an object with keys
'createvalueindes' and 'default'. What am I doing wrong?
--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/9858ac83-05e7-4a1a-aa93-1543a945e7bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...