Skip to content Skip to sidebar Skip to footer

"module Fs Cannot Be Found"

i have used var module = require('/path/to/node_modules/module-name') and all of my other models get recognized but fs does not get recognized even though I've pointed to where it

Solution 1:

In node.js, fs is a native, built-in module. You include it without any path as in:

const fs = require('fs');

Here's the list of built-in libs from the node.js source:

const builtinLibs = [
  'assert', 'async_hooks', 'buffer', 'child_process', 'cluster', 'crypto',
  'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net', 'os',
  'path', 'punycode', 'querystring', 'readline', 'repl', 'stream',
  'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'
];

Post a Comment for ""module Fs Cannot Be Found""