npm安裝淘寶鏡像報錯問題解決(npm install -g cnpm)
我們首先在為創(chuàng)建兩個文件夾設(shè)置路徑
npm config set prefix="D:\Environment\nodejsRepository\node_global" npm config set cache="D:\Environment\nodejsRepository\node_cache"
然后設(shè)置淘寶鏡像
npm config set registry https://registry.npm.taobao.org
這樣會創(chuàng)建一個注冊表在c盤用戶目錄中(這是我的C:\Users\love13)

接著便是安裝淘寶鏡像 npm install -g cnpm
接著出現(xiàn)這個問題:
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path D:\Program Files\nodejs\node_cache\_cacache
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node_cache\_cacache'
npm ERR! [OperationalError: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node_cache\_cacache'] {
npm ERR! cause: [Error: EPERM: operation not permitted, mkdir 'D:\Program Files\nodejs\node_cache\_cacache'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\Program Files\\nodejs\\node_cache\\_cacache'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\Program Files\\nodejs\\node_cache\\_cacache'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

有的解決方案是刪除注冊表,可是千萬別刪!千萬別刪!千萬別刪!
這時候關(guān)閉命令提示符,然后重新使用管理員權(quán)限進入安裝即可
到此這篇關(guān)于npm安裝淘寶鏡像報錯問題解決(npm install -g cnpm)的文章就介紹到這了,更多相關(guān)npm安裝淘寶鏡像報錯內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
node命令行工具之實現(xiàn)項目工程自動初始化的標準流程
這篇文章主要介紹了node命令行工具之實現(xiàn)項目工程自動初始化的標準流程 ,本文分步驟給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-08-08
Node使用Nodemailer發(fā)送郵件的方法實現(xiàn)
這篇文章主要介紹了Node使用Nodemailer發(fā)送郵件的方法實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2020-02-02
node express如何實現(xiàn)json轉(zhuǎn)Excel
這篇文章主要介紹了node express如何實現(xiàn)json轉(zhuǎn)Excel問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-08-08
詳解Wondows下Node.js使用MongoDB的環(huán)境配置
這篇文章主要介紹了詳解Wondows下Node.js使用MongoDB的環(huán)境配置,這里使用到了Mongoose驅(qū)動來讓JavaScript操作MongoDB,需要的朋友可以參考下2016-03-03

