当我尝试构建项目时,对构建CSS有误解

时间:2019-05-31 17:10:02

标签: reactjs npm

我每次运行构建时都遇到错误,我在此项目上遇到这些错误,我正在使用材料工具包,其依赖关系可能是其中一个依赖关系已久的人,请帮助我从事此工作已经好几天了,我感到真的很失败。我已经安装了react-scripts并运行了react-scripts Build,但无济于事

npm ERR! missing script: build-css
npm ERR!
npm ERR! Did you mean this?
npm ERR!     build

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-05-31T00_03_48_444Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! material-kit-react@1.4.0 build: `npm run build-css && react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the material-kit-react@1.4.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\user\AppData\Roaming\npm-cache\_logs\2019-05-31T00_03_48_505Z-debug.log

我想运行npm运行build-css,但我不想破坏y代码

Packages.json文件---!

 {
      "name": "material-kit-react",
      "version": "1.4.0",
      "description": "Material Kit React. Coded by Creative Tim",
      "private": true,
      "main": "dist/index.js",
      "dependencies": {
        "@material-ui/core": "3.9.2",
        "@material-ui/icons": "3.0.2",
        "classnames": "2.2.6",
        "history": "4.7.2",
        "moment": "2.24.0",
        "node-sass": "4.11.0",
        "nouislider": "13.1.0",
        "prop-types": "15.7.1",
        "react": "16.8.1",
        "react-datetime": "2.16.3",
        "react-dom": "16.8.1",
        "react-router-dom": "4.3.1",
        "react-scripts": "2.1.5",
        "react-slick": "0.23.2",
        "react-swipeable-views": "0.13.1"
      },
      "devDependencies": {
        "@babel/cli": "7.2.3",
        "@babel/plugin-proposal-class-properties": "7.3.0",
        "@babel/preset-env": "7.3.1",
        "@babel/preset-react": "7.0.0"
      },
      "optionalDependencies": {
        "eslint-config-prettier": "4.0.0",
        "eslint-plugin-prettier": "3.0.1"
      },
      "scripts": {
        "start": "react-scripts start",
        "build": "npm run build-css && react-scripts build",
        "test": "react-scripts test --env=jsdom",
        "eject": "react-scripts eject",
        "lint:check": "eslint . --ext=js,jsx;  exit 0",
        "lint:fix": "eslint . --ext=js,jsx --fix;  exit 0",
        "install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
        "build-package-css": "node-sass src/assets/scss/material-kit-react.scss dist/material-kit-react.css",
        "build-package": "npm run build-package-css && babel src --out-dir dist",
        "compile-sass": "node-sass src/assets/scss/material-kit-react.scss src/assets/css/material-kit-react.css",
        "minify-sass": "node-sass src/assets/scss/material-kit-react.scss src/assets/css/material-kit-react.min.css --output-style compressed",
        "map-sass": "node-sass src/assets/scss/material-kit-react.scss src/assets/css/material-kit-react.css --source-map true"
      },
      "browserslist": [
        ">0.2%",
        "not dead",
        "not ie <= 11",
        "not op_mini all"
      ]
    }

我希望构建文件夹可以构建

1 个答案:

答案 0 :(得分:1)

要解决此问题,请将构建脚本更改为:

"build": "react-scripts build"

参考:https://github.com/creativetimofficial/material-kit-react/issues/52