使用 sass-resources-loader 构建下一个构建失败

时间:2021-02-09 23:22:06

标签: reactjs ubuntu npm next.js yarnpkg

我正在尝试在 digtailocan node -v 上的 ubuntu 服务器上构建 nextjs 项目 15.8.0

纱线 -v 1.22.5

操作系统 ubuntu 20.04 它在我的 macOS 上成功构建,但不是在服务器上构建我不知道为什么 也在 Windows 上取得成功

package.json

  "name": "travelyalla-react",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "next",
    "start": "next start -p 3006",
    "build": "next build"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@ant-design/icons": "^4.0.6",
    "antd": "^4.4.2",
    "axios": "^0.20.0",
    "babel-plugin-import": "^1.13.0",
    "less": "^3.11.1",
    "less-vars-to-js": "^1.3.0",
    "next": "^9.4.4",
    "next-redux-wrapper": "^4.0.1",
    "node-sass": "^4.14.0",
    "react": "^16.12.0",
    "react-dom": "^16.13.1",
    "react-qr-code": "^1.0.2",
    "react-redux": "^7.1.3",
    "react-redux-i18n": "^1.9.3",
    "react-slick": "^0.27.13",
    "react-thunk": "^1.0.0",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "redux-thunk": "^2.3.0",
    "slick-carousel": "^1.8.1",
    "universal-cookie": "^4.0.3"
  },
  "devDependencies": {
    "@types/next-redux-wrapper": "^3.0.0",
    "@types/node": "^13.1.5",
    "@types/react": "^16.9.17",
    "@types/react-redux": "^7.1.5",
    "@zeit/next-css": "^1.0.1",
    "@zeit/next-sass": "^1.0.1",
    "@zeit/next-typescript": "^1.1.1",
    "next-images": "^1.3.0",
    "sass-resources-loader": "^2.1.1",
    "typescript": "^3.7.4",
    "url-loader": "^3.0.0"
  }
} 

next.config.js

const withSass = require('@zeit/next-sass');
const withImages = require('next-images');
const withCSS = require('@zeit/next-css');

module.exports = withCSS(
    withSass(
        withImages(
            {
                webpack: (config, { buildId, dev, isServer, defaultLoaders }) => {
                    config.module.rules.push(
                        {
                            enforce: "pre",
                            test: /.scss$/,
                            loader: "sass-resources-loader",
                            options: {
                                resources: ['./styles.scss']
                            }
                        },
                        {
                            test: /\.(eot|woff|woff2|ttf|svg)$/,
                            use: {
                                loader: 'url-loader',
                                options: {
                                    limit: 100000,
                                    name: '[name].[ext]'
                                }
                            }
                        }

                    );
                    return config
                }
            }
        )
    )
); 

错误是 error screen shot

请帮忙 什么可能的事情可以在 ubuntu 上实现这一点

0 个答案:

没有答案