91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

node.js報錯:npm?ERR?code?EPERM如何解決

發布時間:2022-08-04 17:48:55 來源:億速云 閱讀:1029 作者:iii 欄目:開發技術

今天小編給大家分享一下node.js報錯:npm ERR code EPERM如何解決的相關知識點,內容詳細,邏輯清晰,相信大部分人都還太了解這方面的知識,所以分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后有所收獲,下面我們一起來了解一下吧。

    1 完整錯誤

    npm ERR! code EPERM
    npm ERR! syscall open
    npm ERR! path D:\NodeJS\node_cache\_cacache\tmp\7bbab18e
    npm ERR! errno EPERM
    npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open 'D:\NodeJS\node_cache\_cacache\tmp\7bbab18e'
    npm ERR!     at D:\NodeJS\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
    npm ERR!     at async Arborist.[nodeFromEdge] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
    npm ERR!     at async Arborist.[buildDepStep] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
    npm ERR!     at async Arborist.buildIdealTree (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
    npm ERR!     at async Promise.all (index 1)
    npm ERR!     at async Arborist.reify (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
    npm ERR!     at async Install.install (D:\NodeJS\node_modules\npm\lib\install.js:170:5)
    npm ERR!  FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open 'D:\NodeJS\node_cache\_cacache\tmp\7bbab18e'
    npm ERR!     at D:\NodeJS\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
    npm ERR!     at async Arborist.[nodeFromEdge] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
    npm ERR!     at async Arborist.[buildDepStep] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
    npm ERR!     at async Arborist.buildIdealTree (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
    npm ERR!     at async Promise.all (index 1)
    npm ERR!     at async Arborist.reify (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
    npm ERR!     at async Install.install (D:\NodeJS\node_modules\npm\lib\install.js:170:5) {
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'open',
    npm ERR!   path: 'D:\\NodeJS\\node_cache\\_cacache\\tmp\\7bbab18e',
    npm ERR!   type: 'system',
    npm ERR!   requiredBy: '.'
    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.
    (base) PS F:\tutorial-frontend\webpack\code> npm i webpack webpack-cli --save-dev
    npm ERR! code EPERM
    npm ERR! syscall open
    npm ERR! path D:\NodeJS\node_cache\_cacache\tmp\671f2a33
    npm ERR! errno EPERM
    npm ERR! FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open 'D:\NodeJS\node_cache\_cacache\tmp\671f2a33'
    npm ERR!     at D:\NodeJS\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
    npm ERR!     at async Arborist.[nodeFromEdge] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
    npm ERR!     at async Arborist.[buildDepStep] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
    npm ERR!     at async Arborist.buildIdealTree (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
    npm ERR!     at async Promise.all (index 1)
    npm ERR!     at async Arborist.reify (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
    npm ERR!     at async Install.install (D:\NodeJS\node_modules\npm\lib\install.js:170:5)
    npm ERR!  FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/webpack: EPERM: operation not permitted, open 'D:\NodeJS\node_cache\_cacache\tmp\671f2a33'
    npm ERR!     at D:\NodeJS\node_modules\npm\node_modules\minipass-fetch\lib\body.js:162:15
    npm ERR!     at async Arborist.[nodeFromEdge] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:1061:19)
    npm ERR!     at async Arborist.[buildDepStep] (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:930:11)
    npm ERR!     at async Arborist.buildIdealTree (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\build-ideal-tree.js:216:7)
    npm ERR!     at async Promise.all (index 1)
    npm ERR!     at async Arborist.reify (D:\NodeJS\node_modules\npm\node_modules\@npmcli\arborist\lib\arborist\reify.js:149:5)
    npm ERR!     at async Install.install (D:\NodeJS\node_modules\npm\lib\install.js:170:5) {
    npm ERR!   code: 'EPERM',
    npm ERR!   syscall: 'open',
    npm ERR!   path: 'D:\\NodeJS\\node_cache\\_cacache\\tmp\\671f2a33',
    npm ERR!   type: 'system',
    npm ERR!   requiredBy: '.'
    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.

    2 錯誤詳解

    該錯誤發生在修改npm的全局安裝路徑之后,再執行npm install 包 -g或是npm install 包時發生,但是在管理員身份下運行cmd,均能執行成功。

    2.1 修改npm全局安裝:

    1.命令行:

    npm config set prefix "D:\NodeJS\node_global"
    npm config set cache "D:\NodeJS\node_cache"

    在C盤User/用戶名/下有一個.npmrc的文件

    2.將上述node_global文件夾的路徑加入環境變量

    2.2 導致該安裝問題的原因

    沒有管理員權限,無法在node_globalnode_cache兩個文件夾下進行一些必要的操作

    2.3 修復方法

    • 刪除用戶下的.npmrc文件,即不改變全局安裝的路徑(不夠好,本質問題仍沒有解決,全局還是會安裝在C盤)

    • 每次都用管理員身份運行命令行(不夠方便,vscode 下的命令行默認也不是管理員身份運行的)

    • 直接修改node_globalnode_cache文件夾的權限:

    右鍵文件夾,打開屬性,切換到安全選項卡

    node.js報錯:npm?ERR?code?EPERM如何解決

    選擇編輯,將沒有打鉤的位置全部打上鉤(即將其它用戶的權限設置為與管理員相同),應用即可。

    3 運行測試

    安裝webpack測試,成功!

    npm i webpack webpack-cli -g
    npm i webpack webpack-cli --save-dev

    以上就是“node.js報錯:npm ERR code EPERM如何解決”這篇文章的所有內容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會為大家更新不同的知識,如果還想學習更多的知識,請關注億速云行業資訊頻道。

    向AI問一下細節

    免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

    AI

    二连浩特市| 泸西县| 育儿| 龙川县| 永年县| 龙陵县| 昌黎县| 正宁县| 开阳县| 分宜县| 通州区| 灵山县| 永济市| 宁明县| 固安县| 五莲县| 都兰县| 馆陶县| 玉环县| 旌德县| 邵阳县| 鹤庆县| 个旧市| 康乐县| 阿坝县| 龙陵县| 南川市| 阳东县| 石门县| 玉山县| 普兰店市| 佳木斯市| 星子县| 峨边| 威远县| 贵溪市| 怀安县| 库车县| 英山县| 井陉县| 宁都县|