如何在使用 node.js 时停止 WSH 执行
How to stop WSH execution while working with node.
我运行 拒绝test.js 文件使用
>node test.js
test.js是简单的代码
var fs = require("fs");
fs.readFile('2.rtf', function (err, data) {
if (err) return console.error(err);
console.log(data.toString());
});
console.log("Program Ended");
显示错误
所以我很自然地删除了扩展名和 运行 以下命令,效果很好。
node test
我是运行windows7 32位。如何在使用 node commnad 时停止 WSH?
问题似乎是您在同一目录中有一个名为 node.js
的文件,并且由于 Windows 解析命令的方式,它正在尝试执行文件 node.js
(使用该文件类型的默认处理程序,通常是 JScript)而不是 node
node.js 可执行文件。将 node.js
文件重命名为其他名称,它应该可以工作。
我运行 拒绝test.js 文件使用
>node test.js
test.js是简单的代码
var fs = require("fs");
fs.readFile('2.rtf', function (err, data) {
if (err) return console.error(err);
console.log(data.toString());
});
console.log("Program Ended");
显示错误
所以我很自然地删除了扩展名和 运行 以下命令,效果很好。
node test
我是运行windows7 32位。如何在使用 node commnad 时停止 WSH?
问题似乎是您在同一目录中有一个名为 node.js
的文件,并且由于 Windows 解析命令的方式,它正在尝试执行文件 node.js
(使用该文件类型的默认处理程序,通常是 JScript)而不是 node
node.js 可执行文件。将 node.js
文件重命名为其他名称,它应该可以工作。