npm鏡像源證書過期的問題解決
Failed to check for updates 問題
錯誤描述如上
檢查完 node
,vue
,npm
的版本后都沒啥問題,嘗試更新腳手架
使用指令
#npm腳手架更新
pnpm update -g @vue/cli
出現(xiàn)問題如下:
ERR_PNPM_NO_PKG_MANIFEST
這個是報錯類型編號
這個報錯是沒有找到 package.json
的文件,我當(dāng)時沒仔細(xì)看,就嘗試重新安裝 pnpm
#pnpm更新安裝
npm install pnpm -g
出現(xiàn)報錯
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/pnpm failed, reason: certificate has expirednpm ERR! Log files were not written due to an error writing to the directory: D:\Nodejavascript\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
在這里已經(jīng)很明顯了,報錯提示是 #reason:certificate_has_expired 就是說目前我的鏡像網(wǎng)站證書過期了,連淘寶自己提供的鏡像源網(wǎng)站都不去管管證書的嘛??(來自我復(fù)盤的吐槽)
當(dāng)時認(rèn)為是不是自己的問題,進行 npm
緩存清除操作,
npm緩存清除指令
npm cache clean --force
出現(xiàn)第二個報錯
PS D:\front-end\untitled2> npm cache clean --force
npm WARN using --force Recommended protections disabled.
npm ERR! code EPERM
npm ERR! syscall rmdir
npm ERR! path D:\Nodejavascript\node_cache\_cacache\tmp
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rmdir 'D:\Nodejavascript\node_cache\_cacache\tmp'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'rmdir',
npm ERR! path: 'D:\\Nodejavascript\\node_cache\\_cacache\\tmp'
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! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.npm ERR! Log files were not written due to an error writing to the directory: D:\Nodejavascript\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
其實這個也說的很清楚,Error:EPERM:operation not permitted,rmdir ‘D:\Nodejavascript\node_cache\_cacache\tmp’
就是說沒有權(quán)限刪除,這個問題一般有幾種解決思路
權(quán)限不足導(dǎo)致刪除不了解決方案
- 如果是在C盤的文件遇到權(quán)限不足,建議移出C盤,因為C盤的權(quán)限是一個迷,很容易出現(xiàn)奇奇怪怪的權(quán)限問題
- 如果是在其他盤,直接開管理員權(quán)限運行就可以了
之后明白可能是證書和權(quán)限的問題,就打算隨便執(zhí)行一下依賴更新操作,檢驗一下是否可用
#npm依賴更新指令
npm install
然后給我直接報錯了 #沒有package的Json文件報錯
PS D:\front-end\untitled2> npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\front-end\untitled2/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\front-end\untitled2\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoentnpm ERR! Log files were not written due to an error writing to the directory: D:\Nodejavascript\node_cache\_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
Wrote to D:\front-end\untitled2\package.json:
npm創(chuàng)建基礎(chǔ)配資文件
npm init -y
這樣就默認(rèn)創(chuàng)建了一個簡單的 package.json
文件
ok! 到此為止,就基本上將邊角問題解決了,后續(xù)考慮解決問題是否應(yīng)該切換一個數(shù)據(jù)源的問題
#npm檢查設(shè)置遠(yuǎn)程倉庫指令
npm config get registry
得到域名
https://npm.taobao.org
去網(wǎng)上搜,淘寶那個npm
改名了!??!
https://npmmirror.com/
最新的是這個,我真的心情復(fù)雜。
設(shè)置一下全局鏡像源配置就行了,最后完成目的的指令是
npm config set registry=https://npmmirror.com/
如果出現(xiàn)以下這種錯誤,就是說明鏡像源太落后了,不匹配
PS D:\front-end\untitled3> npm install
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @vue/server-renderer@3.4.21.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in: D:\Nodejavascript\node_cache\_logs\2024-02-29T04_10_05_694Z-debug-0.log
PS D:\front-end\untitled3> npm config set
npm ERR! code EUSAGE
npm ERR!
主要從這幾句話可以看出 notarget No matching version found for @vue/server-renderer@3.4.21
這個是之前我換華為云的鏡像服務(wù)器之后出現(xiàn)的問題,最后實在不行了,換回了 https://npmmirror.com/
這個域名
從此,解決 npm
無法使用問題
到此這篇關(guān)于npm鏡像源證書過期的問題解決的文章就介紹到這了,更多相關(guān)npm鏡像源證書過期內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用Redis和Node.js來開發(fā)簡單的實時聊天功能
在眾多實時通信的技術(shù)中,Redis和Node.js的結(jié)合是一種非常強大和流行的選擇,Redis是一種高性能的鍵值存儲數(shù)據(jù)庫,而Node.js是一個基于事件驅(qū)動的JavaScript運行時環(huán)境,兩者的結(jié)合可以輕松實現(xiàn)實時聊天功能,本文將指導(dǎo)您使用Redis和Node.js來開發(fā)一個簡單的實時聊天功能2024-08-08NPM命令運行報錯:npm?v10.2.4?is?known?not?to?run?on?Node.js
這篇文章主要給大家介紹了關(guān)于NPM命令運行報錯:npm?v10.2.4?is?known?not?to?run?on?Node.js?v14.21.1的解決辦法,文中將解決辦法介紹的非常詳細(xì),需要的朋友可以參考下2024-01-01