简体   繁体   中英

How to fix errors that showing when I'm using command npm run build?

I try to run npm run build output is below error:

   root@tim-VPCEB42EG:/home/tavinder/es6# npm run build
    npm ERR! Linux 4.15.0-39-generic
    npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
    npm ERR! node v4.2.6
    npm ERR! npm  v3.5.2

    npm ERR! missing script: build
    npm ERR! 
    npm ERR! If you need help, you may report this error at:
    npm ERR!     <https://github.com/npm/npm/issues>

    npm ERR! Please include the following file with any support request:
    npm ERR!     /home/tavinder/es6/npm-debug.log

It means you're missing a script.NPM should know which script to run when that command is executed. If you have a build script, in your package.json, under scripts:

"scripts": {
    "test": "jest"
    "build": "name of your build script"
  },  

For example, on one of my projects,

"scripts": {
    "lint": "./node_modules/.bin/eslint .",
    "lint:fix": "./node_modules/.bin/eslint . --fix || true",
    "build": "babel src -d dist --presets es2015",
     .....
  }

Your node version: 4.2.6 Node version required by latest version of webpack : minimum 6.11.6 You either need to update your node or use a version of webpack that's compatible with our node version 在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM