0
我正在使用create-react-app來構建Node項目。如何解決「Node not found中的模塊:'readline'」節點項目
我已經使用npm -i --save-dev sat-words
來安裝一個名爲sat-words
的模塊。然而,當我運行該項目,它告訴我
Module not found: 'readline' ...
在sat-words
的index.js
文件,它使用readline
讀取文本文件,如:
var rl = require('readline').createInterface({
input: require('fs').createReadStream(__dirname + '/word-list.txt')
});
但Node.js的文檔readline
在是一個核心模塊。爲什麼會拋出一個錯誤,指出模塊在運行時沒有找到?
create-react-app將所有js文件放在src'文件夾中。我使用'npm start'命令來運行程序。 – newguy