此問題Node.js prompt '>' can not show in eshell解決了節點repl的問題,但是當您從npm調用節點時,該解決方案不起作用。npm在emacs下無法正確顯示提示符eshell
例如,如果我讓
$ 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
或者,如果你有一個的package.json有 「腳本」:{ 「開始」: 「節點」}
$ npm start
npm WARN package.json [email protected] No README.md file found!
> node
^[[1G^[[0J> ^[[3G
我知道這一個可以使用「start」來解決:「env NODE_NO_READLINE = 1個節點」,但是到處寫這個不是一個尋找解決方案。也許包的其他用戶不使用emacs並需要以其他方式設置env var。
我有一個別名NPM設置NODE_NO_READLINE = 1,但同樣的結果
alias npm='env NODE_NO_READLINE=1 npm'
您的解決方案適用於shell,但不適用於eshell。 eshell使用eshell-output-filter-functions使用類似的方法進行過濾(add-to-list 'shell-output-filter-functions'(lambda() (save-excursion (replace-regexp「\\ [0-9] + [GKJ]」 「」 無 \t \t ESHELL-最後輸出啓動 \t \t ESHELL-最後輸出端)))) 作品,但速度慢。我在想什麼是如何告訴npm使用NODE_NO_READLINE = 1 –
我得到: > console.log('是這種切割出奇怪的方式?') console.lo('是這個cuttin東西出奇怪的方式?') 這停止特殊字符,但我不再有克。 comint特殊字符格式看起來像是什麼樣的正則表達式? – Mittenchops
正則表達式必須是「\ 033 \\ [[0-9] + [GK]」爲mw工作基於http://stackoverflow.com/questions/13862471/using-node-js-with-js-comint -in-emacs – pellekrogholt