An error is as follows
checked online related:
.
because package json file does not have to configure the build script, so the above error!
Solutions:
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
https://www.cnblogs.com/eyunhua/p/6507100.html
Read More:
- NPM run build failed to package err! Missing script: build
- NPM run serve reported an error “NPM err! Missing script: start”
- HTML echo error, NPM run build error, HTML path error
- To solve the problem of NPM run eject error in react
- NPM can’t find D: //nodejs/node all of The solution of sudden_modules/NPM/bin/npm-cli.js
- NPM run dev error: cannot find module ‘webpack cli / bin / config yargs‘
- Error failed to compile with 1 errors after finding NPM run dev
- NPM run dev error (ERR: Code lifecycle)
- [Solved] VUE-pdf Plugin use error: To install them, you can run: npm install –save core-js/modules/es
- After installing nodejs, run NPM on the command line and report error: cannot find module ‘internal / util / types’
- Vue executes NPM run Dev and reports an error: missing script: dev
- NPM and cnpm installation failure solution
- npm run devstart error: Error: Unable to find module ‘semver’
- The solution of NPM err! Code elifecycle
- Vue の NPM run serve error: parsing error: unexpected token<
- Solution of NPM err! Code elifecycle
- NPM installs dependent packages and reports an error node gyp rebuild… Solution
- NPM error ‘cannot find module’ internal / util / types’ solution;
- NPM report error: eperm: operation not permitted, unlink… Solution and clear cache_ modules
- Go run error go run: cannot run non main package