为了账号安全,请及时绑定邮箱和手机立即绑定

/Users/WJ/Desktop/hello.js: line 1: syntax error near unexpected token `('怎么处理

mac中终端

/Users/WJ/Desktop/hello.js: line 1: syntax error near unexpected token `('

/Users/WJ/Desktop/hello.js: line 1: `var server=http.createServer(function(req,res){'


js代码:

var server=http.createServer(function(req,res){

  res.writeHead(200,{"Content-type":'text/html'});

  res.end('hello world');

});

server.listen(8124,'127.0.0.1',function(){

  console.log('服务器创建成成功:127.0.0.1:8124');

});


怎么处理


正在回答

1 回答

加'use strict'试试

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
进击Node.js基础(一)
  • 参与学习       219315    人
  • 解答问题       982    个

本视频教程带你揭开Node.js的面纱,带你走进一个全新世界

进入课程

/Users/WJ/Desktop/hello.js: line 1: syntax error near unexpected token `('怎么处理

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号