mac運行npm時報錯It is likely you do not have the permissions to access this file as the current user

在yarn下載包的時候node-sass報錯,包不能下載

node版本太高了,v2.13.0

所以在使用終端更改node版本時,報錯,再次使用npm安裝n時報錯

mac運行npm時報錯It is likely you do not have the permissions to access this file as the current user

錯誤如圖:

 

解決方法:

修改安裝目錄的權限 
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share} 
或者命令前面加sudo。

然後流暢的使用npm了。

1、首先安裝n模版:sudo npm install -g n

2、n後面也可以跟隨版本號,升級到任意版本:sudo n v0.10.26或sudo n 0.10.26

3、切換使用版本:sudo n 7.10.0

4、刪除置頂版本:sudo n rm 2.10.0

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章