我尝试开始使用Lektor CMS内部,并希望在伟大的Pycharm调试器下运行它。特别是我想要运行
$ lektor server
我按照步骤
$ git clone https://github.com/lektor/lektor
$ cd lektor
$ virtualenv venv
$ . venv/bin/activate
$ pip install --editable .
$ make build-js
$ make install-git-hooks
$ export LEKTOR_DEV=1
$ lektor quickstart --path example-project
$ lektor --project example-project server
在Github上有关开发的自述文件,它们在终端中工作得很好。然后我创建了以下Pycharm debug-config:
但是这会引发以下RuntimeException:
Traceback (most recent call last):
File "/home/barrios/IDEs/pycharm-community-2018.1.1/helpers/pydev/pydevd.py", line 1664, in <module>
main()
File "/home/barrios/IDEs/pycharm-community-2018.1.1/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/barrios/IDEs/pycharm-community-2018.1.1/helpers/pydev/pydevd.py", line 1085, in run
runpy._run_module_as_main(module_name, alter_argv=False)
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/home/barrios/code/lektor/lektor/__main__.py", line 3, in <module>
main(as_module=True)
File "/home/barrios/code/lektor/lektor/cli.py", line 627, in main
cli.main(args=args, prog_name=name)
File "/home/barrios/code/lektor/venv/local/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/barrios/code/lektor/venv/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/barrios/code/lektor/venv/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/barrios/code/lektor/venv/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/barrios/code/lektor/venv/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/home/barrios/code/lektor/venv/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/barrios/code/lektor/lektor/cli.py", line 387, in server_cmd
browse=browse)
File "/home/barrios/code/lektor/lektor/devserver.py", line 124, in run_server
dt.start()
File "/home/barrios/code/lektor/lektor/devserver.py", line 75, in start
portable_popen(['npm', 'install', '.'], cwd=admin).wait()
File "/home/barrios/code/lektor/lektor/utils.py", line 486, in portable_popen
raise RuntimeError('Could not locate executable "%s"' % cmd[0])
RuntimeError: Could not locate executable "npm"
Process finished with exit code 1
显然它无法找到npm来初始化Web-UI。用'build'替换参数'server'时,调试工作正常。从Pycharm调试器里面通过子进程运行这个Javascript代码是不可能的吗?
或者我还做错了什么?任何想法如何解决这一问题? TNX提前。
编辑:我在其他一些SO线程中读到Pycharm可能在virtualenv之外的系统Python解释器下运行一个子进程?!?这可以解释为什么它会混淆依赖关系,但是npm命令可以在系统的任何地方使用......那么为什么找不到它?