I try to get started with Lektor CMS internals and would like to run it under the great Pycharm debugger. In particular I want to run
$ lektor server
I followed the steps
$ 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
in the Github readme about development and they work just fine in the terminal. Then I created the following Pycharm debug-config:
However this throws the following 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
Obviously it can't find npm to init the Web-UI. When replacing the parameter 'server' with 'build', debugging works fine. Is it impossible to run this Javascript code via subprocess from inside Pycharm debugger?
Or what else am I doing wrong? Any ideas how to fix this? TNX in advance.
EDIT: I read in some other SO-thread Pycharm is probably running a subprocess under the system Python interpreter outside the virtualenv?!? This would explain why it messes up dependencies, but the npm command IS available anywhere on the system... So why is it not found???