簡體   English   中英

NPM多次安裝錯誤

[英]NPM multiple install errors

當我嘗試安裝npm時,控制台會顯示以下錯誤和警告:

 npm WARN checkPermissions Missing write access to C:\\Users\\Aristophanes\\node_modules\\web3 npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN eslint-config-react-app@2.1.0 requires a peer of babel-eslint@^7.2.3 but none is installed. You must install peer dependencies yourself. npm WARN eslint-config-react-app@2.1.0 requires a peer of eslint@^4.1.1 but none is installed. You must install peer dependencies yourself. npm WARN eslint-loader@1.9.0 requires a peer of eslint@>=1.6.0 <5.0.0 but none is installed. You must install peer dependencies yourself. npm WARN eslint-plugin-jsx-a11y@5.1.1 requires a peer of eslint@^2.10.2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself. npm WARN firebase-functions@2.1.0 requires a peer of firebase-admin@~6.0.0 but none is installed. You must install peer dependencies yourself. npm ERR! path C:\\Users\\Aristophanes\\node_modules\\web3 npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall access npm ERR! enoent ENOENT: no such file or directory, access 'C:\\Users\\Aristophanes\\node_modules\\web3' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: npm ERR! C:\\Users\\Aristophanes\\AppData\\Roaming\\npm-cache\\_logs\\2018-11-02T23_13_12_948Z-debug.log 

有誰知道我該如何解決? 謝謝。

嘗試刪除web3文件夾C:\\Users\\Aristophanes\\node_modules\\web3 ,還有node_modules在項目目錄文件夾(如果存在)。 希望它能對您有所幫助:)

有兩種解決方案。

**1. Reinstall npm with a Node version manager (recommended).**

這是避免權限問題的最佳方法。 有關更多信息,請參閱此鏈接(https://docs.npmjs.com/getting-started/installing-node#using-a-version-manager-to-install-nodejs-and-npm)您不需要刪除安裝Node版本管理器之前,使用當前版本的npm或Node.js。

**2. Change npm's default directory manually.**

如果您不使用Windows,則可以使用以下步驟。

To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, it will be a hidden directory on your home folder.

Back-up your computer before you start.

Make a directory for global installations:

mkdir〜/ .npm-global

Configure npm to use the new directory path:

npm config設置前綴'〜/ .npm-global'

Open or create a ~/.profile file and add this line:

導出PATH =〜/ .npm-global / bin:$ PATH

Back on the command line, update your system variables:

來源〜/ .profile

測試:在不使用sudo的情況下全局下載軟件包。

npm install -g jshint

可以使用相應的ENV變量代替步驟2-4(例如,如果您不想修改〜/ .profile):

 NPM_CONFIG_PREFIX=~/.npm-global

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM