Module build failed: Error: Loading PostCSS Plugin failed: Cannot find module 'postcss-import'

See original GitHub issue

Following the readme instruction I can’t get it to work

Details

yarn add --dev postcss-loader

Module build failed: Error: Loading PostCSS Plugin failed: Cannot find module 'postcss-import'

Error (Logs|Stacks)

ERROR in ./node_modules/css-loader!./node_modules/postcss-loader/lib?{"config":{"path":"config/postcss.config.js"}}!./node_modules/sass-loader/lib/loader.js!../src/pdui.scss
Module build failed: Error: Loading PostCSS Plugin failed: Cannot find module 'postcss-import'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at load (/data/projects/peopledoc-ui/webpack-demo/node_modules/postcss-load-plugins/lib/plugins.js:44:18)
    at /data/projects/peopledoc-ui/webpack-demo/node_modules/postcss-load-plugins/lib/plugins.js:66:18
    at Array.forEach (<anonymous>)
    at plugins (/data/projects/peopledoc-ui/webpack-demo/node_modules/postcss-load-plugins/lib/plugins.js:65:8)
    at /data/projects/peopledoc-ui/webpack-demo/node_modules/postcss-load-config/index.js:64:18
    at <anonymous>
 @ ../src/pdui.scss 4:14-209 18:2-22:4 19:20-215
 @ ./src/index.js

Reproduction [Code]

webpack-demo/config/postcss.config.js

module.exports = {
  parser: 'sugarss',
  plugins: {
    'postcss-import': {},
    'postcss-cssnext': {},
    'cssnano': {}
  }
}

webpack.config.js

{
	test: /\.scss$/,
	use: [
		{loader: "style-loader"},
		{loader: "css-loader"},
		{
			loader: "postcss-loader",
			options: {config: {path: 'config/postcss.config.js'}}
		},
		{loader: "sass-loader"}
	]
}

Environment


Please provide information about your environment.

OS node npm PostCSS
Linux Mint 18.2 v8.7.0 5.5.1 ^2.0.8

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

180reactions
t00768nhcommented, Apr 12, 2018

テンプレートイメージで写真アップすると大きくはみ出ますね https://gyazo.com/1bfc1606b3feb9579395b776d52b0ad8

115reactions
edouard-lopezcommented, Nov 7, 2017

Pluging are not in the core, you need to install them, for instance

yarn add --dev \
  postcss-loader \
  postcss-import \
  postcss-cssnext \
  cssnano \
  sugarss \
  autoprefixer
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Loading PostCSS Plugin failed: Cannot find module ...
I published it on npmjs and encountered the error of the lack of the 'postcss-import' module after installing the package in the project...
Read more >
Error: Loading PostCSS Plugin failed: Cannot find module &#3
Expected behavior. I expected it to work. Actual behavior. Failed to compile. ./node_modules/mdbvue/lib/css/mdb.min.css (.
Read more >
postcss-import - npm
PostCSS plugin to transform @import rules by inlining content. This plugin can consume local files, node modules or web_modules. To resolve path ...
Read more >
Vue Loading PostCSS "postcss-import" plugin failed - 简书
Loading PostCSS "postcss-import" plugin failed: Cannot find module 'postcss-import'. 安装: npm install postcss-url--save-dev.
Read more >
Error: Loading PostCSS Plugin failed: Cannot find module ...
src/App.vue?vue&type=style&index=0&lang=scss& Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'autoprefixer' Require ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found