npm ERR! Code elifecycle solution
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:
webpack --config config/webpack. config. js
npm ERR! Exit status 1
npm ERR! Failed at the [email protected] build script.
The reason for this is the webpack.config.js configuration error, which is actually a path configuration error. Some path configurations in webpack.config.js are configured according to the package.json file location, and some are configured according to the current file location, and people tend to get confused when configuring them.
2.1 Solution 1
Fill in the correct path, this problem is often caused by the path configuration error. Refer to the following template, I will decipher the path configuration.
entry:’. /src/js/index.js’ // this path is based on the package.json file as the base file path (not the webpack.config.js file)
template in plugins: ‘src/index.html’ //this is also based on the package.json file as the base file path
and path:path.resolve(__dirname,’…/dist’) // is based on the webpack.config.js file path
const path=require(‘path’); // call the path in node.js
const HtmlWebpackPlugin = require(‘html-webpack-plugin’);
entry:’. /src/js/index.js’, // the file to be packaged (this path is written according to the package.json location)
filename:’bundle.js’, //the name of the package file
path:path.resolve(__dirname,’…/dist’) //specify the generated file directory (written by the current file location)
use: [ ‘style-loader’, ‘css-loader’ ]
template: ‘src/index.html’ //configure html template (by package.json location)
2.2 Solution 2
Direct reinstallation, but personally do not recommend, indeed some files reinstallation is possible to solve the problem, but sometimes reinstallation is very slow, which is annoying. Reinstallation steps are as follows.
(Do not delete package.json, delete package-lock.json)
npm cache clean --force rm -rf node_modules rm -rf package-lock.json npm install
- [Solved] Package Install Error: npm ERR code ERR_SOCKET_TIMEOUT npm ERR
- [Solved] NPM err! Cannot read property ‘parent’ of null npm ERR! A complete log of this run can be found in: npm ERR!
- [Solved] npm Install vuex Error: npm ERR! code ERESOLVE
- [Solved] Vue3 npm ERR code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
- [Solved] npm install Error: error code ERR_SOCKET_TIMEOUT
- After installing NPM, NRM LS reports an error throw new err_INVALID_ARG_TYPE(name, ‘string‘, value)
- npm install error code EINTEGRITY sha1 [How to Solve]
- [Solved] Vue2 Cross-domain Error: AxiosError net::ERR_FAILED, Network Error, ERR_NETWORK
- “Failed to load resource: net::ERR_FILE_NOT_FOUND” error. The project created by vue-cli 3.0 can run under dev, and an error is reported after packaging, and the page is blank.
- [Solved] /sockjs-node/info?t= net::ERR_SSL_PROTOCOL_ERROR
- [Solved] npm Error: Class extends value undefined is not a constructor or null
- [Solved] Node.js v17 npm run dev Error: opensslErrorStack
- npm connect ETIMEDOUT Error [How to Solve]
- npm run dev Error: opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error‘ ]
- [Solved] gyp ERR! stack Error: Could not find any Python installation to use
- [Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
- [Solved] NPM Error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
- vue-elemnt-admin npm run dev [How to Solve]
- [Solved] npm run start Error: Exit status 3221225477
- How to Solve NPM installation -g @view/client Error