javascriptnode.jsnodemon

nodemon Internal watch failed: watch /Users/admin/Library/Application Support/Code/1.26.1-shared.sock Unknown system error -102


I installed nodemon in my Macbook Pro using sudo npm install nodemon -g command just today.

I am trying to run my Node JS code using the below command.

nodemon /Users/admin/nodejs/my-express-server/src/index.js

The script starts fine however immediately terminates with the below error.

[nodemon] Internal watch failed: watch /Users/admin/Library/Application Support/Code/1.26.1-shared.sock Unknown system error -102

enter image description here

I see few similar instances of questions already in Stack Overflow, however the error code/scenario is different. Also, I tried the answers from those similar questions and it didn't help.


Solution

  • So from the comments I got to know that you are running nodemon from your user directory or home directory. which is ~ or /Users/admin in your case.

    Now nodemon watches EVERY directory and subdirectory for file changes. You can see that by watching dir(s): *.*

    So when you are running:

    nodemon /Users/admin/nodejs/my-express-server/src/index.js
    

    You are running the index.js file but you are telling nodemon to watch every directory and file under the current working directory(which is /Users/admin in your case).

    So, many Mac installations, application support files, basically every file you ever create by default goes to any directory under the home directory.

    Now nodemon checks every file for change and the nodemon coudldn't put watch on vscode shared.lock file probably because of permission issue or the file is being opened by vscode itself.

    Long story short(not really), go to the /Users/admin/nodejs/my-express-server/ folder and run nodemon from there.

    cd /Users/admin/nodejs/my-express-server
    nodemon src/index.js