Web/nodeJS

"NPM error" after installing "yarn"

Jueun Park 2020. 1. 19. 00:17

I've been used the "npm" only, but I heard the "yarn" is more convenient.

So I installed "yarn", to try it in my new node project.

"yarn" was 👍, but suddenly "npm" didn't work.

zsh gave me an error "zsh: command not found: npm"

To solve this problem, I start googgling based on the error message.

I found few solutions like "Change the zsh setting," "Change the PATH," and so on.

But those didn’t work for me at all.

I asked myself when does the matter started, and I got the answer.

Just before I got error, I installed "yarn." After the install, I couldn’t use "npm."

So I changed my searching point, from "zsh: command not found: npm" to "npm error after yarn"

My take away from this experience is "Knowing the situation that caused the error is important."

Search by error messages is great solution, but it isn’t a only way to solve the problem.


npm만 쓰다가 yarn을 써보려고 설치를 했는데 그 이후로 npm이 작동을 하지 않았다.

그걸 모르고 계속 왜 npm이 안되나 하면서 PATH나 zsh 문제인 줄로만 알고 그 쪽을 계속 구글링을 했다.

그러다가 yarn을 설치한 후 부터 안되었던 게 생각이 나서 

"npm error after install yarn"으로 검색하니까 해결방법이 바로 떴다.

npm을 global하게 다시 install하니까 거짓말처럼 잘 됐다.