“找不到模块 fs" [英] "module fs cannot be found"

查看:123
本文介绍了“找不到模块 fs"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 var module = require('/path/to/node_modules/module-name') 并且我的所有其他模型都被识别但 fs 没有即使我已经指出它的位置并确保它已安装,也能得到认可??看不懂,求帮忙

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 is and made sure that its installed?? i do not understand, please help

我的控制台给出了这个:http://prntscr.com/g2akvs

my console gives out this: http://prntscr.com/g2akvs

但我所有的其他模块都很好

but all my other modules are fine

正如您通过我的参考所看到的:http://prntscr.com/g2akzm

as you can see by my referencing: http://prntscr.com/g2akzm

推荐答案

在 node.js 中,fs 是一个原生的内置模块.您将它包含在没有任何路径的情况下:

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

const fs = require('fs');

这是来自 的内置库列表node.js 源码:

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'
];

这篇关于“找不到模块 fs"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆