nodemon not working: -bash: nodemon: command not found

前端 未结 18 820
灰色年华
灰色年华 2021-01-30 03:45

I\'m on a Mac running El Capitan. I have node v5.6.0 and npm v3.6.0. When I try to run nodemon, I get:

-bash: nodemon: command not found

I th

18条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-30 04:27

    Make sure you own root directory for npm so you don't get any errors when you install global packages without using sudo.

    procedures:- in root directory

    sudo chown -R yourUsername /usr/local/lib/node_modules
    sudo chown -R yourUsername /usr/local/bin/
    sudo chown -R yourUsername /usr/local/share/
    

    So now with

    npm i npm -g 
    

    you get no errors and no use of sudo here. but if you still get errors confirm node_modules is owned again

    /usr/local/lib/

    and make sure you own everything

    ls -la

    now

    npm i -g nodemon
    

    will work!

提交回复
热议问题