我正在使用WebStorm进行使用Node,NPM和Gulp的相当简单的项目。我的一个Gulp任务最终在子进程中执行gulp lint
,除非我gulp
上有PATH
,否则我
[14:20:37] Starting 'lint-parallel'... events.js:160 throw er; // Unhandled 'error' event ^ Error: spawn gulp ENOENT at exports._errnoException (util.js:1018:11) at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32) at onErrorNT (internal/child_process.js:367:16) at _combinedTickCallback (internal/process/next_tick.js:80:11) at process._tickCallback (internal/process/next_tick.js:104:9)
所以我的问题是:设置WebStorm的正确方法是什么node_modules/.bin
在PATH
上?我最终在Gulp设置→环境中将PATH
设置为node_modules/.bin:<rest of path>
,但它对于非常基本的行为感觉非常手动。或者我应该在我的shell配置文件中使用PATH=node_modules/.bin:$PATH
并让WebStorm以这种方式选择它?
答案 0 :(得分:2)
WebStorm在从终端启动时继承您的交互式shell环境,并在从Desktop或System菜单启动时使用在~/.profile
(登录shell)中配置的环境变量。因此,您需要确保node_modules/.bin
已添加到相应配置中的$PATH
以获取它