cireu / jieba.el

在Emacs中使用jieba中文分词
GNU General Public License v3.0
45 stars 7 forks source link

(error "[JIEBA] Current backend: node is not available!") #9

Open pallas42 opened 3 years ago

pallas42 commented 3 years ago

doom emacs M-x jieba-forward-word 后报错 "Current backend: node is not available!"
emacs --debug-init 报错的backtrace:

Debugger entered--Lisp error: (error "[JIEBA] Current backend: node is not available!")
  signal(error ("[JIEBA] Current backend: node is not available!"))
  error("[JIEBA] Current backend: %s is not available!" node)
  jieba--assert-server()
  jieba--chinese-word-atpt-bounds(25 27)
  jieba--move-chinese-word(nil)
  jieba-forward-word(1)
  funcall-interactively(jieba-forward-word 1)
  call-interactively(jieba-forward-word record nil)
  command-execute(jieba-forward-word record)
  counsel-M-x-action("jieba-forward-word")
  ivy-call()
  ...

config.el中的配置:

(use-package! jieba
  :load-path "~/node_modules/nodejieba"
  ;;:command jieba-mode
  :init (jieba-mode))

nodejieba貌似是安装成功的 cli下 npm list 显示 nodejieba@2.4.2

cireu commented 3 years ago

Have you run npm i in the plugin directory?

pallas42 commented 3 years ago

Thanks! npm i shows lots of packages deprecated, so I ran npm upgrade and then npm i, the result as follows. While the "Current backend: node is not available!" issue persists.

➜ npm i

> nodejieba@2.4.2 install
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.14.0
node-pre-gyp info using node@15.0.1 | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
[nodejieba] Success: "/Users/pallas/node_modules/nodejieba/build/Release/nodejieba.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
node-pre-gyp info ok

up to date in 1s

The issue persists after upgrading nodejieba to @2.5.1. (The local nodejieba module is working properly in terminal)

wanghuibin0 commented 2 years ago

这个库作者还维护吗?这么久了这个还是open

cireu commented 2 years ago

这个库作者还维护吗?这么久了这个还是open

因为俺没法复现

Hxppdv commented 1 year ago

This should be a problem with doom emacs. More specifically, it's a problem with straight.el. it just add .el files to the load path.

barddust commented 1 year ago

问题可能是在use-package:load-path,它不能直接传字符串,要传一个函数(我看了我的配置才发现)

:load-path (lambda () "xxxx")