Run nodejs npm package from notepad++ console
Вопрос
I'm trying to run some nodejs apps in Notepad++. I installed NppExec and node
works just fine in the console, but npm packages don't run even though I installed them with the -g
flag. My current workaround is to call cmd
from the console and then running the app like:
// `cmd` inside Notepad++ console
C:\>lessc "$(FULL_CURRENT_PATH)" > "$(CURRENT_DIRECTORY)\$(NAME_PART).css"
How can I run it straight from the Notepad++ console without having to go into cmd
?
Решение
Frankly this looks like a bug in NppExec, where it cannot run .cmd files from PATH.
A workaround would be to run:
where lessc
You'll get the path to the command like: C:\Users\username\AppData\Roaming\npm\lessc.cmd
Use that path inside NppExec console.
C:\Users\username\AppData\Roaming\npm\lessc.cmd "$(FULL_CURRENT_PATH)" > "$(CURRENT_DIRECTORY)\$(NAME_PART).css"
However I'd stick to the solution you already found, looks far more better to me.
Другие советы
Know this is old but still appears high up google results. To run .bat or .cmd you need to add the extension.
npp.cmd start
From Docs Npp_Exec Manual:
The same approach can be used to execute .bat and .cmd files - but the file extension (.bat or .cmd) can not be omitted in this case.
cmd /c cd $(CURRENT_DIRECTORY) & node $(FILE_NAME) & pause