小编And*_*ner的帖子

npm install child_process无效

我想使用child_process模块​​从node.js运行脚本但是当我运行命令时

npm install child_process我收到以下错误:

npm http GET https://registry.npmjs.org/ChildProcess
npm http 404 https://registry.npmjs.org/ChildProcess
npm ERR! 404 'ChildProcess' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
Run Code Online (Sandbox Code Playgroud)

只是想知道是删除了child_process模块​​还是我拼错了模块名称.

谢谢.

node.js

11
推荐指数
1
解决办法
2万
查看次数

将串行数据从python脚本发送到节点脚本

我有两个脚本 - 一个python脚本和另一个节点脚本.python脚本在infinte循环中运行并读取串行数据.收到串行数据后,必须将其传递给node.js scipt,以便在节点服务器中处理.

我想过使用node.js child_process模块​​从python脚本中读取数据,但由于python脚本是一个无限循环,它不会将任何数据返回给节点脚本.谁能告诉我如何解决这个问题?

Python脚本:

import serial
ser = serial.Serial('COM10', 9600, timeout =1)
while 1 :
    print ser.readline()'
Run Code Online (Sandbox Code Playgroud)

Node.js脚本:

var spawn = require('child_process').spawn,
ls    = spawn('python',['pyserial.py']);

ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});

ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
Run Code Online (Sandbox Code Playgroud)

注意:我使用python脚本的唯一原因是node.js串口模块由于serialport模块中的某些问题而无法正在为我的项目工作.

node.js

5
推荐指数
2
解决办法
4471
查看次数

将app推送到heroku时,如何解决非快进更新错误?

在尝试更新heroku中的第一个node.js应用程序时,我有点困在这里.

该应用程序的初始版本已成功部署,但现在当我尝试部署修改后的应用程序时,它给了我一些问题.这是命令和输出

> git push heroku master
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:....git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the 'Note 
about fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)

git status命令显示如下:

On branch master
Your branch is ahead of 'origin/master' by 1 commit.
Run Code Online (Sandbox Code Playgroud)

git heroku

2
推荐指数
1
解决办法
1814
查看次数

标签 统计

node.js ×2

git ×1

heroku ×1