简体   繁体   中英

Errors when running npm run build

Im trying to create my built folder for a react project, but I get this error when I run the command 'npm run build'

(base) tazar@Tazs-Air nft-minter-tutorial-main % npm run build
npm ERR! Missing script: "build"
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/tazar/.npm/_logs/2022-02-25T01_15_14_544Z-debug.log

in your package.json file add build script, for example:

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

You can check standard react package.json(which is located in root folder of your project) file:

{
  "name": "print",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

如果在您的 package.json 文件中定义了构建,请确保您在正确的文件夹层次结构中执行“npm run build”(使用不带参数的“cd”或“pwd”)。

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