最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

“ node filename.js”在vs代码中不起作用

IT培训 admin 4浏览 0评论

“ node filename.js”在vs代码中不起作用

我在vs代码中创建了一个hello.js文件,其中包含console.log,当我在终端node hello.js中键入时,出现以下错误:

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

是因为vs代码?我应该使用另一个IDE吗?

回答如下:

您的hello.js文件代码在哪里?您输入了正确的代码吗?

“ node filename.js”在vs代码中不起作用

我在vs代码中创建了一个hello.js文件,其中包含console.log,当我在终端node hello.js中键入时,出现以下错误:

SyntaxError: Invalid or unexpected token
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

是因为vs代码?我应该使用另一个IDE吗?

回答如下:

您的hello.js文件代码在哪里?您输入了正确的代码吗?

发布评论

评论列表 (0)

  1. 暂无评论