gpt4 book ai didi

node.js - 将 node_modules/.bin 放在 WebStorm 的 PATH 上的正确方法

转载 作者:太空宇宙 更新时间:2023-11-03 23:23:48 27 4
gpt4 key购买 nike

我正在使用 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上?我最终设置了 PATH在Gulp设置→环境node_modules/.bin:<rest of path> ,但对于非常基本的行为来说感觉非常手动。或者我应该有 PATH=node_modules/.bin:$PATH在我的 shell 配置文件中并让 WebStorm 以这种方式获取它?

最佳答案

WebStorm 在从终端启动时继承您的交互式 shell 环境,并在从桌面或系统菜单启动时使用 ~/.profile(登录 shell)中配置的环境变量。因此,您需要确保将 node_modules/.bin 添加到相应配置中的 $PATH 中以获取它

关于node.js - 将 node_modules/.bin 放在 WebStorm 的 PATH 上的正确方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46836725/

27 4 0