2017-07-30 72 views
-1

我已經使用var module = require('/path/to/node_modules/module-name')和我所有的其他型號都可以識別,但是fs沒有被識別,即使我已經指出它在哪裏,並確保它的安裝?我不明白,請大家幫忙「module fs can not be found」

我的控制檯給出這樣的: http://prntscr.com/g2akvs

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

,你可以通過我的參考,請參閱: http://prntscr.com/g2akzm

+2

'fs'是土生土長的NodeJS模塊,它前人的精力原樣導入: '讓fs = require('fs');' – alexmac

+0

試過了但它不起作用:/ –

+0

同樣的錯誤? – alexmac

回答

2

在節點.js,fs是一個本地內置模塊。你包括它沒有任何路徑,如:

const fs = require('fs'); 

這裏的名單內置庫從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' 
]; 
相關問題