我认为这会奏效:
(defun my-node ()
(interactive)
(pop-to-buffer (make-comint "my-node" "node")))
Run Code Online (Sandbox Code Playgroud)
但是当我这样做M-x my-node
并进入1+1
comint缓冲区时,它不会显示任何输出.
这是在Windows 7上的Emacs 24.0.50.1中安装的NodeJS没有任何特殊配置.
以非交互方式调用node.js,因为M-x compile RET node hello-world.js RET
工作正常.node
交互式运行cmd
工作正常.
这可能是相关的:当我运行M-x shell
并输入node
shell缓冲区然后输入时1+1
,它不会显示结果.我必须遗漏一些非常基本的东西.
更新:
可能相关:emacs/Python:在行缓冲与块缓冲模式下运行python-shell - Stack Overflow
我想在eshell中运行Node.js,但提示不正确:
那么,我该如何解决这个问题呢?
我使用nodejs-mode
的Emacs 24
,但是当我键入:
M-x nodejs
Run Code Online (Sandbox Code Playgroud)
它提示垃圾提示[0J>
,现在即使我已经添加到下面
(setq ansi-color-for-comint-mode t)
Run Code Online (Sandbox Code Playgroud)
在emacs
文件中.它仍然无效.
所有相同的,如果我node
打开目录Emacs shell-mode
,那么我会得到一个更烦人的提示,如下所示:
ryu@ryu:~$ node
[1G[0J> [3G
Run Code Online (Sandbox Code Playgroud)
有谁知道它为什么会这样?
这个问题Node.js提示'>'无法在eshell中显示解决节点repl的问题,但是当你从npm调用node时,该解决方案不起作用.
举例来说,如果我做
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sane defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
^[[1G^[[0Jname: (nodo1) ^[[15G
Run Code Online (Sandbox Code Playgroud)
或者如果你有一个带有"脚本"的package.json:{"start":"node"}
$ npm start
npm …
Run Code Online (Sandbox Code Playgroud)