Zsh: command not found: webpack

后端 未结 6 980
借酒劲吻你
借酒劲吻你 2021-02-04 01:54

I\'m learning React and installed webpack through npm to my project directory but zsh is not finding the command even though I can see webpack installed in my project. I used

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 02:39

    In my case I had this problem with webpack, grunt and gulp and seems that my problem was an issue with permissions.

    I installed webpack and grunt globally. However, even then, $ webapack or $ grunt resulted in command not found

    The problem was that npm installed the global packages to /usr/local/lib/node_modules which required root permissions.

    So, to avoid having to use root permissions, I changed the directory in which global packages are to be installed to a directory in $HOME. To do this, I followed this guide:

    Install npm packages globally without sudo on macOS and Linux

    After this, I installed webpack and grunt globally again (this time without sudo) and verified that they have been installed in my new directory.

    Now, I can run without problem!

    $ webpack

    and

    $ grunt

提交回复
热议问题