我已经使用快速生成器启动了一个node.js应用程序,我有一个奇怪的问题,我无法通过浏览器两次查看页面,第一次加载正常,第二次没有因为节点进程结束以下错误:
GET / 304 412ms
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:988:11)
at Process.ChildProcess._handle.onexit (child_process.js:779:34)
Run Code Online (Sandbox Code Playgroud)
的package.json
{
"name": "example01-express",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node-dev ./bin/www"
},
"dependencies": {
"body-parser": "~1.0.0",
"cookie-parser": "~1.0.1",
"debug": "~0.7.4",
"express": "~4.2.0",
"jade": "~1.3.0",
"morgan": "~1.0.0",
"node-compass": "0.2.3",
"static-favicon": "~1.0.0"
},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-cssmin": "*",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-sass": "*",
"grunt-contrib-uglify": "*",
"grunt-contrib-watch": "*",
"grunt-cssc": "*",
"grunt-htmlhint": "*",
"matchdep": "*"
}
}
Run Code Online (Sandbox Code Playgroud) 当我使用visual studio代码调试nodejs应用程序时.视觉工作室代码告诉我request 'launch': cannot launch target (reason: spawn node ENOENT)

我的nodejs版本是4.2.4
我刚刚下载了Python和Visual Studio.我正在尝试测试一个简单的"Hello World"脚本的调试功能,我收到此错误:
无法启动Python进程,请验证路径'python'
然后在调试控制台中执行此操作:
错误:spawn python ENOENT
有人可以帮帮我,告诉我如何解决这个问题?
我在Windows 10上运行.
谢谢!
我创建了一些代码来使用 node.js 后端的 python 函数。当在我的 ubuntu 计算机上运行它时,它可以工作 - 但是!当在他的 Windows 机器上运行代码时,它会给出这个堆栈跟踪。
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn python ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
[... lines matching original stack trace ...]
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Run Code Online (Sandbox Code Playgroud)
这是node.js 文件
const spawn = require("child_process").spawn;
const pythonProcess = exec('python',["./script.py", 2, 4]);
pythonProcess.stdout.on('data', function(data) {
console.log(data.toString('utf-8'))
} )
Run Code Online (Sandbox Code Playgroud)
这是 …
执行与执行的命令后execSync,sh我注意到以下内容:
spawnSync /bin/sh ENOENT
bin 当前已添加到 PATH。
有什么想法吗?
有一个类似的问题是这样的 Call "ng build" from inside a gulp task
我管理我的 Gulp 以这种方式构建 Angular 以免溢出输出缓冲区
const child = require('child_process');
// Temporary solution, progress option makes angular more quiet,
// but I need to shut it up completely
gulp.task('build', ['compile'], (cb) => {
child.exec('ng build --progress false', (e, stdout, stderr) => {
cb(e);
});
});
Run Code Online (Sandbox Code Playgroud)
不幸的是,这只能用作临时解决方案,因为只要 Angular 项目中的文件数量继续增长,子进程.exec 的输出缓冲区迟早会溢出,所以我想使用子进程。 spawn 从 Gulp 构建 Angular,但每次我执行这个
// This is how I want to make it to work
gulp.task('build', ['compile'], () => {
child.spawn('ng', ['build']); …Run Code Online (Sandbox Code Playgroud) node.js ×5
javascript ×2
spawn ×2
angular ×1
enoent ×1
express ×1
gulp ×1
pdf ×1
python-3.x ×1