- 執行 emacs
- 以M-! path執行系統路徑檢視,看看目前環境設定中是否已有舊版node.js,記錄其位置,在安裝新版時可以考慮安裝在同一位置以覆寫之
- 到 https://nodejs.org/en/ 下載最新版(我抓的是 node-v6.9.1-x64.msi )並安裝
- 接下來試試新模組的安裝,以此模組為例 https://www.npmjs.com/package/google-scholar
- 新建並進入測試目錄,以放置範例程式及所用到的模組
- 在命令列視窗執行 npm install google-scholar --save
- 範例程式如下,C-x C-f新建此檔案,輸入完整目錄、檔案名稱(記得副檔名為js),複製貼上以下內容
'use strict'
let scholar = require('google-scholar')
scholar.search('CRISPR')
.then(resultsObj => {
console.log(resultsObj)
})
- M-! node 完整目錄、檔案名稱(記得副檔名為js),結果會出現在另一視窗
- 一些 emacs 上執行命令的方式列舉如下,自己看者辦囉
- M-! cmd RET
- Run the shell command line cmd and display the output (shell-command).
- M-| cmd RET
- Run the shell command line cmd with region contents as input; optionally replace the region with the output (shell-command-on-region).
- M-x shell
- Run a subshell with input and output through an Emacs buffer. You can then give commands interactively.
- M-x term
- Run a subshell with input and output through an Emacs buffer. You can then give commands interactively. Full terminal emulation is available.
- M-x eshell
- Start the Emacs shell.
沒有留言:
張貼留言