Solvedngx admin No PostCSS Config found with build:prod

  • I'm submitting a ...
    [x ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository

When I try to deploy the dashboard using Jenkins on a Linux environment, I am getting the following error

 ERROR in ./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader?sourceMap!./~/bootstrap-loader/lib/bootstrap.styles.loader.js!./~/bootstrap-loader/no-op.js
Module build failed: Error: No PostCSS Config found in: /app/jenkins/workspace/dashboard/node_modules/bootstrap-loader
at Error (native)
at /app/jenkins/workspace/Toolbox-web/node_modules/postcss-load-config/index.js:51:26
@ ./~/style-loader!./~/css-loader!./~/postcss-loader!./~/resolve-url-loader!./~/sass-loader?  sourceMap!./~/bootstrap-loader/lib/bootstrap.styles.loader.js!./~/bootstrap-loader/no-op.js 4:14-193
@ ./~/bootstrap-loader/lib/bootstrap.loader.js!./~/bootstrap-loader/no-op.js
 @ ./~/bootstrap-loader/loader.js
@ ./src/vendor.browser.ts

Any idea on what the problem might be?

20 Answers

✔️Accepted Answer

Or you can create a file named postcss.config.js in root directory.
Just leave it empty or write the following line.

module.exports = {};

It is a temp fix if you want to use postcss-loader with version > 1.2.1.

Other Answers:

I had the same issue, I manage to fix it by changing in the dependencies of my package.json :
"postcss-loader": "^1.0.0" by "postcss-loader": "1.0.0"
and adding "postcss-load-config": "1.0.0"

Adding postcss.config.js is a good solution. However, if you want to avoid adding an extra file, read how I solved it:

I had the Error: No PostCSS Config found issue after upgrading to postcss-loader version 2.0.6 and because I was still using Webpack's LoaderOptionsPlugin. But with the latest version of PostCSS, you should no longer use that plugin. You can place the PostCSS configuration right within your Webpack rules (and no longer use the LoaderOptionsPlugin). That solved my issue. See how I added options to the postcss-loader:

...
      test: /\.s?css$/,
      exclude: /node_modules/,
      use: ExtractTextPlugin.extract({
        use: [{
          loader: 'css-loader'
        }, {
          loader: 'postcss-loader',
          options: {
            plugins: (loader) => [
              require('postcss-smart-import'),
              require('autoprefixer'),
            ]
          }
        }, {
          loader: 'sass-loader'
        }]
      })
...

FWIW, I had to create the postcss.config.js (with module.exports={}) to get things working again. Even with the latest commit which locks the version to 1.0.0 and adds the loader entry, the problem is not resolved without the minimal config file.

better solution... since you're obviously using webpack, add a postcss: {} key val to your webpack config. or if using webpack 2, loader options plugin, pass that key val pair.

More Issues: