In an .mjs file, you do not use require.  You use import.  Try:

import fs from "fs";

More info:
https://nodejs.org/api/esm.html

-John

On Sun, Jun 7, 2020, 9:33 AM Matthew Hamilton <buddhatr...@gmail.com> wrote:

> node.js 14.4.0 macOS Catalina, Visual Studio Code debugging. Line 11 in my
> app.mjs file is var FileSystem = require('fs'); The debugger throws
> "require is not defined" error on this line. Comment this line out and the
> debugger throws an error on line 23 which is var PDFImage =
> require('pdf-image'). the pdf-image package is installed. I'm not sure what
> is going on. The only help I can find is about require not working in a
> browser. I AM NOT RUNNING IN A BROWSER. I AM RUNNING IN NODE.JS. Thank you!
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/6ede6143-eb84-4678-9d36-269feae52b62o%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/6ede6143-eb84-4678-9d36-269feae52b62o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAMbK04y0KES8Bak-yQ7b8gtVDLh9SeocmzyrDprdi%3DEzrE_jTw%40mail.gmail.com.

Reply via email to