Expressを持つノードサーバーがあります。私は私のコードは次のようになりますし、私の意見では正しいはずにもかかわらず、モジュール「HTML」のエラーを見つけることができません取得する:Express NodeJS 'html'モジュールを見つけることができません
app.set('views', path.join(__dirname, 'build/views'));
app.use(favicon(path.join(__dirname, "build/favicon.ico")));
app.use('/scripts', express.static(path.join(__dirname, 'node_modules')));
app.use(express.static(path.join(__dirname, 'build')));
app.get('/', function(req, res){
res.render('index.html');
});
'res.sendFile(path.join(__ dirname + '/build/views/index.html')); ' これはいい解決策になるのだろうか、それともあなたの解決策が良いか/いい? – thigi
コード構造の記述に依存します。私たちは '静的な'ページを取得するために 'views'を好む – abdulbarik
これはhtmlで動作しません+ – thigi