简体   繁体   中英

NPM multiple install errors

When I try to install npm the console gives the following errors & warnings:

 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 

Does anyone know how I can fix this? Thank you.

Try removing the web3 folder in C:\\Users\\Aristophanes\\node_modules\\web3 , as well as the node_modules folder in your project directory (if exists). Hope it will help you :)

There are 2 solutions for this.

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

This is the best way to avoid permissions issues. For more information, refer this link (https://docs.npmjs.com/getting-started/installing-node#using-a-version-manager-to-install-nodejs-and-npm) You do not need to remove your current version of npm or Node.js before installing a Node version manager.

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

If you're not using windows you can use below steps.

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 set prefix '~/.npm-global'

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

export PATH=~/.npm-global/bin:$PATH

Back on the command line, update your system variables:

source ~/.profile

Test: Download a package globally without using sudo.

npm install -g jshint

Instead of steps 2-4, you can use the corresponding ENV variable (eg if you don't want to modify ~/.profile):

 NPM_CONFIG_PREFIX=~/.npm-global

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM