Vue solves the problem: Webpack installation is unsuccessful, and webpack -v cannot display the version number normally

Table of contents

1. Solve the problem: Webpack installation is unsuccessful, and webpack -v cannot display the version number normally

2. Solve the problem: ERROR Error: Cannot find module 'webpack-log'

3. Solve the error: error:03000086:digital envelope routines::initialization error

四、解决报错:To install them, you can run: npm install --save core-js/modules/es.array.concat.js core-js/modules/es.array.filter.js core-js/modules/es.array.includes.js core-js/modules/es.array.map.js core-js/modules/es.array.push.js core-js/modules/es.array.slice.js


1. Solve the problem: Webpack installation is unsuccessful, and webpack -v cannot display the version number normally

Scenario reproduction : Install Webpack and Webpack-cli in cmd,

The above installation process is normal.

But when webpack -v is executed, the version information is not displayed, and the following strange content is displayed:

  System:
    OS: Windows 10 10.0.22000
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 24.66 GB / 31.68 GB
  Binaries:
    Node: 18.14.2 - D:\my_ruanjian\nodejs\node.EXE
    npm: 6.14.18 - D:\my_ruanjian\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (107.0.1418.56)
    Internet Explorer: 11.0.22000.120

Reason : After webpack was installed, but the corresponding version number could not be found and the above information was output, retried several times, and changed to other versions, but it could not be resolved. The reason is still failed to install successfully.

Solution : Add the version number to be installed after @. If the demand is not large, you can install the relatively stable 3.xx. I installed 3.6.0.

​npm install [email protected] -g

If you query again, you can successfully query the version number of webpack.

ok, successfully resolved.

2. Solve the problem: ERROR Error: Cannot find module 'webpack-log'

Scenario reproduction : start the basic template vue project in the official website in vscode,

Official website address: Introduction | vue-element-admin

 After downloading the zip, unzip it, then open it with vscode, first enter the project directory, install dependencies,

# 安装依赖
npm install

After that, execute the start command.

Execute the start command:

npm run dev

Reason : After webpack was installed, but the corresponding version number could not be found and the above information was output, retried several times, and changed to other versions, but it could not be resolved. The reason is still failed to install successfully.

Solution : Add the version number to be installed after @. If the demand is not large, you can install the relatively stable 3.xx. I installed 3.6.0.

​npm install [email protected] -g

If you query again, you can successfully query the version number of webpack.

ok, successfully resolved.

Next, install webpack-cli under the project,

npm install  --save-dev webpack
npm install  --save-dev webpack-cli

 

3. Solve the error: error:03000086:digital envelope routines::initialization error

Scenario recurrence : Then, the start command was executed, but another error occurred.

error:03000086:digital envelope routines::initialization error 

 

Reason : It may be caused by the version of nodeJS. The specific error reason: ERR_OSSL_EVP_UNSUPPORTED error SSL digital envelope is not supported.

Solution:

(1) Downgrade nodejs or uninstall the current nodejs and re-download and install

It doesn't make sense to upgrade and then downgrade. Although it is possible, you always have to upgrade in the end, so it is not recommended.

(2) Modify environment variables

$env:NODE_OPTIONS="--openssl-legacy-provider"

ok, the problem is solved.

四、解决报错:To install them, you can run: npm install --save core-js/modules/es.array.concat.js core-js/modules/es.array.filter.js core-js/modules/es.array.includes.js core-js/modules/es.array.map.js core-js/modules/es.array.push.js core-js/modules/es.array.slice.js

Scenario recurrence : Then, the start command was executed, but another error occurred.

Reason : Because core.jsthe version

Solution:

You also need to use the install command again,

npm install core-js@2

 Then, re-execute the start command,

npm run dev

 ok, the problem is solved.

Guess you like

Origin blog.csdn.net/qq_45956730/article/details/129290001