NPM cannot install dependencies - Attempt to unlock something which hasn't been locked

前端 未结 9 1581
独厮守ぢ
独厮守ぢ 2020-12-02 03:59

I\'ve been trying to run an npm install on my package.json file, but I\'m having a lot of trouble. It keeps saying \"Error: Attempt to unlock XXX, which hasn\'t been locke

9条回答
  •  既然无缘
    2020-12-02 04:28

    I worked with a co-worker this afternoon and figured out what the problem was. My ".npm" folder in my home directory was owned by the root user instead of myself. I'm not sure what happened to cause that. Maybe I installed node or npm as the root admin at one point. In any case I just ran sudo chown -R [username] .npm and I was finally able to run npm install commands from my projects again!

提交回复
热议问题