Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Errore node.js

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2016
    Messaggi
    11

    Errore node.js

    Salve sono nuovo(forum e su node.js)seguendo il tutorial sul sito ho creato il primo "programmino" in node js

    codice:
    var http = require('http');
    var server = http.createServer(function(req,res){
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.end('First app');
    }
    
    
    server.listen(1337, '127.0.0.1');
    
    
    console.log('Server running at http://127.0.0.1:1337/');
    eseguo con node path_to_file/first_app.js e mi restituisce questo sulla
    chiamata server.listen(1337, '127.0.0.1');:
    codice:
    >SyntaxError: Unexpected identifier
        at Object.exports.createScript (vm.js:44:10)
        at REPLServer.defaultEval (repl.js:117:23)
        at bound (domain.js:254:14)
        at REPLServer.runBound [as eval] (domain.js:267:12)
        at REPLServer.<anonymous> (repl.js:279:12)
        at REPLServer.emit (events.js:107:17)
        at REPLServer.Interface._onLine (readline.js:214:10)
        at REPLServer.Interface._line (readline.js:553:8)
        at REPLServer.Interface._ttyWrite (readline.js:830:14)
        at ReadStream.onkeypress (readline.js:109:10)
    >

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2016
    Messaggi
    11
    Quote Originariamente inviata da Marduk87 Visualizza il messaggio
    Salve sono nuovo(forum e su node.js)seguendo il tutorial sul sito ho creato il primo "programmino" in node js

    codice:
    var http = require('http');
    var server = http.createServer(function(req,res){
        res.writeHead(200, {'Content-Type': 'text/plain'});
        res.end('First app');
    }
    
    
    server.listen(1337, '127.0.0.1');
    
    
    console.log('Server running at http://127.0.0.1:1337/');
    eseguo con node path_to_file/first_app.js e mi restituisce questo sulla
    chiamata server.listen(1337, '127.0.0.1');:
    codice:
    >SyntaxError: Unexpected identifier
        at Object.exports.createScript (vm.js:44:10)
        at REPLServer.defaultEval (repl.js:117:23)
        at bound (domain.js:254:14)
        at REPLServer.runBound [as eval] (domain.js:267:12)
        at REPLServer.<anonymous> (repl.js:279:12)
        at REPLServer.emit (events.js:107:17)
        at REPLServer.Interface._onLine (readline.js:214:10)
        at REPLServer.Interface._line (readline.js:553:8)
        at REPLServer.Interface._ttyWrite (readline.js:830:14)
        at ReadStream.onkeypress (readline.js:109:10)
    >
    errore mio non avevo chiuso una parentesi tonda,potete chiudere.

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.