Tag Archives: Npm

Error: getaddrinfo enoent error resolution

error: getaddrinfo enoent error resolution

When NPM run dev is used to run Vue project, error: getaddrinfo enoent is reported as follows:

Cause of the problem:

Localhost is not bound to


Find the hosts file in C:// Windows/system32/Drivers/etc , add to the hosts file, and save it, as shown in the figure below:

Gyp err! Build error stack error

Error content:

gyp ERR! build error
gyp ERR! stack Error: `C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe` failed with exit code: 1

Repeat several times and still report an error.
Check the problem. The yarn version is normal, and the image is also a Taobao image.


1. Execute NPMI – G node gyp command
2. Delete directory/node_ All files under modules
3. Re install.

In addition, it can be seen on the Internet that it may be due to the node version. The node version needs to be lowered. I didn’t try this method. I don’t know if it’s feasible.

@Solution of error failed to get response from / Vue cli version marker

thank: [email protected] Questions provided.

Today, they encountered a very interesting bug. When they created a project with @ Vue/cli, they reported an error, which they had never seen before:

At first, I thought it was a version problem. After all, the error message said update, but the version of CLI was the latest. After asking, the node and NPM versions were also the latest (12.16.1, which was the latest as of the time I wrote this article). Most importantly, there was no old version of Vue cli

That’s very interesting. According to convention, when encountering the front-end problem, the first reaction is to unload and reload

npm uninstall -g @vue/cli
npm cache clean --force
npm install -g @vue/cli

However, it’s useless. After checking for a long time, we can’t find the relevant error report on the Internet, which is very embarrassing.

Later, I noticed that there is an output of yarn below. Is the built-in yarn in cli?But this shouldn’t be:

although I think it’s incredible, I still decided to look at the version of yarn. Yarn is highly suspected. Sure enough:

the problem was found. But what is this?Hadoop?

Later, I remembered that yarn is also a part of Hadoop, which is used to schedule resources:

Error: EBUSY: resource busy or locked

Error: EBUSY: resource busy or locked, LSTAT ‘C:\ swapfile.sys ’。
Here are some effective methods I summarized:

Method 1: delete node_ Module, and then install (NPMI);
method 2: delete node_ Modules, run NPM cache clean or NPM cache clean — force command, and then install;
method 3: upgrade the node version and delete the node_ Modules, and then install it.

Error code elifecycle errorno when NPM install command is executed in Vue project

Error code elifecycle errorno 1 when NPM install command is executed in Vue project

The complete error report is as follows

D:\workspace\dev\qorosauto-icv-ota-ui>npm install

> [email protected] install D:\workspace\dev\qorosauto-icv-ota-ui\node_m
> node install.js

PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantom
Saving to C:\Users\xufeng.fu\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-window

Error making request.
Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)

Please report this full log at https://github.com/Medium/phantomjs
npm WARN [email protected] requires a peer of [email protected]^5.0.0 but none is installed.
 You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fse
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]
1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}

npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xufeng.fu\AppData\Roaming\npm-cache\_logs\2019-02-26T02_31

Read the error message. It is suspected that there is a problem when installing phantomjs. Try to execute the command NPM cache clear – force to clear the cache, manually download the phantomjs package and extract it to node_ Then execute the NPM install command again, and the execution is successful
note: CSDN can be downloaded for one point

Unable to resolve dependency tree

When installing webpack dev server on the command line, errors are reported all the time, and it is OK to check many places, including the error information on the terminal,

(this is not my error message, I forgot the screenshot, this is in the


(seen on the Internet)

I didn’t see anything,

Finally, I will save my folder except node_ All files except modules are sent to the person who successfully installed them, and they are asked to try whether they can be successfully installed on his computer. As a result, they can be installed

Therefore, it is considered that the plug-in incompatibility is caused by the high version of node

1. Use node – V to view the node version number

2. I installed 15.3.0 node.js Go to the latest version of the official website node.js There is a stable version of 14.15.1 on the Chinese website

3. In the control panel node.js After uninstalling, install with the lower version of the installation package (do not uninstall the higher version of the installation package) node.js Cannot install lower version)

4. Download the plug-in successfully….

Vue init webpack command error Vue cli / node_ modules/_ [email protected]@rimraf/rimraf.js :313

This is a low-level error in Vue development that can be encountered but is shared here so that it can be resolved if encountered
To explain the development environment in which this problem occurs: native Mac + NVM-managed node uses Node V8.0.0 to install vue-cli globally: NPM install vue-cli-g

Error is as follows

/Users/weiyongqiang/.nvm/versions/node/v9.2.0/lib/node_modules/vue-cli/node_modules/[email protected]@rimraf/rimraf.js:313
        throw er

Error: EACCES: permission denied, unlink '/Users/weiyongqiang/.vue-templates/webpack/.gitignore'

Error analysis
This problem is actually relatively simple. The intuitive error is that an exception is thrown on line 313 of rimraf.js. Exploring the cause of this problem requires understanding the role of rimraf.js. It uses the rm -rf command of Unix for deep package deletions. RM-RF is required to operate the corresponding permissions.
Error resolution
Run the vue command with sudo

sudo vue init webpack

Although the solution to this problem is very simple but I believe that many people will encounter, the use of Windows system, of course, will not appear the problem of authority.

NPM run dev error: cannot find module ‘webpack cli / bin / config yargs‘

1- Open your package.json file

"devDependencies": {
    "webpack": "^5.2.0",
    "webpack-cli": "^4.1.0",
    "webpack-dev-server": "^3.11.0"

Webpack-cli: “^4.1.0”, which is version 4.*
2- Uninstall the current webpack-cli directive: NPM uninstall webpack-cli
3.* version directive: NPM install [email protected] -d

Just run NPM run dev!

The problem that headers [‘content-type ‘] does not work is set in the Axios get method request interface

The request headers are set in the Axios wrapper request method and are not present in the Request Headers

    config => {
        config.data = JSON.stringify(config.data);
        config.headers['Authorization'] = getToken();
        config.headers['Content-Type'] = "application/json;charset=utf-8";
        return config;
    error => {
        return Promise.reject();

The Axios source code under NPM removes the Content-Type setting when RequestData is not set

// Add headers to the request
if ('setRequestHeader' in request) {
    utils.forEach(requestHeaders, function setRequestHeader(val, key) {
    if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
      // Remove Content-Type if data is undefined
      delete requestHeaders[key];
    } else {
      // Otherwise add header to the request
      request.setRequestHeader(key, val);

If (typeof requestData === ‘undefined’ & & Key.tolowerCase () === ‘Content-Type ‘)
2. Assign config.data = true to requestData

    config => {
        config.data = JSON.stringify(config.data);
        config.headers['Authorization'] = getToken();

        config.data = true
        config.headers[ 'Content-Type'] = "application/json;charset=utf-8";

        return config;
    error => {
        return Promise.reject();

Reference data: https://blog.csdn.net/qq_24729895/article/details/80367460

NPM run build error solution

An error is as follows

checked online related:
because package json file does not have to configure the build script, so the above error!
1. Add build script to scripts in package.json:

  "scripts": {
    "build": "cross-env NODE_ENV=production webpack --config webpack.config.js"

“NODE_ENV” : user-defined environment variable
webpack “: integrated packaging command
“>config” : config file
“webpa>onfig.js” : config file, which is a Node. js module that returns a JSIN-formatted configuration information object, or the –config option to specify the configuration file

It is possible that ‘cross-env’ is not an internal or external command and is not a executable program
can be resolved by NPM I –save-dev cross-env.
The results of
Execute NPM run build, and the results will appear in the dist folder. Successful packaging!

Reference: https://www.cnblogs.com/tugenhua0707/p/9780621.html