McDodik
@McDodik
MC.Додик

Как исправить данную ошибку?

Как исправить эту ошибку?
См. Ошибка
ReferenceError: __dirname__ is not defined
    at C:\Users\Danil\Desktop\www\index.js:9:21
    at Layer.handle [as handle_request] (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\layer.js:95:5)
    at C:\Users\Danil\Desktop\www\node_modules\express\lib\router\index.js:281:22
    at Function.process_params (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\index.js:335:12)
    at next (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\index.js:275:10)
    at expressInit (C:\Users\Danil\Desktop\www\node_modules\express\lib\middleware\init.js:40:5)
    at Layer.handle [as handle_request] (C:\Users\Danil\Desktop\www\node_modules\express\lib\router\layer.js:95:5)

См. Код
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server);

server.listen(3000);

app.get('/', function (request, respons) {
   respons.sendFile(__dirname__ + '/index.html');
});

См. Скриншот
5dc7197c44f71939307267.png
Я новичок в NodeJS, только начал его учить, мне сложно будет понять (
  • Вопрос задан
  • 86 просмотров
Решения вопроса 1
john36allTa
@john36allTa
alien glow of a dirty mind
См. доку
__dirname#
Added in: v0.1.27
<string>
The directory name of the current module. This is the same as the path.dirname() of the __filename.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы