Table of contents
Friends who are familiar with front-end development know that when you pull a project from github,
before starting the project, you must first use the npm install command to install the module into the project node_modules directory.
Command npm install
一、ERESOLVE unable to resolve dependency tree
1. Possibility 1: The mirror source is inaccessible
注意
: Some companies use their own sources. It is best to ask colleagues to find out what sources npm uses.
Switch the mirror source. Take Taobao as an example:
npm config set registry=https://registry.npm.taobao.org
2. Possibility two: npm version is too low or too high
I found that the version I downloaded was 8 .
The command to switch npm version is as follows
npm -g install [email protected]
3. Possibility three: node and npm versions do not match
But it still didn't work after doing this. I forgot to take a screenshot of the specific error message. It should be a node error, so I looked for the corresponding relationship between node and npm. The corresponding relationship between
node and npm version
The command to switch node version is as follows
# 安装n模块
npm install -g n
# node切换为6.14.10的版本
n v14.15.4
二、Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/yarn’
Reason for error: Unable to access file address
Your git may exist under the usr file. vscode does not have access permissions. Just use sudo to increase permissions.
sudo npm install
三、Error: Can’t find Python executable “python”, you can set the PYTHON env variable.
An error was reported when installing the module. The python environment was missing.
- Install python
Then you need to install python on your computer
and directly download the python installation address
. After downloading, just install it locally.
You can enter python in the terminal, and the version number information will appear, which means it is installed.
Then set the npm config
npm config set python python
四、Syntax Error: Error: ENOENT: no such file or directory……
This error is reported after npm install is successful and npm run serve is executed . You need to execute the following command
npm rebuild node-sass
Another possibility is that you need to switch the mirror source.
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
Anyway, every time npm is initialized, it's really bad luck. This time, it took me an afternoon to get it out. . .