Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails if ../.config/postcssrc is not readable #2044

Open
phil294 opened this issue May 18, 2023 · 2 comments
Open

Build fails if ../.config/postcssrc is not readable #2044

phil294 opened this issue May 18, 2023 · 2 comments

Comments

@phil294
Copy link

phil294 commented May 18, 2023

My Vue project is located in some path using Linux user permissions: The project is at /home/main_user/projects/my_project, but I am logged in as another_user. $HOME is /home/another_user, whoami yields another_user. Still, postcss wants to look into /home/main_user/.config/postcssrc which doesn't make much sense. But since that folder is not readable to another_user, the entire build process fails.

 error  in ./src/components/PromiseForm.vue?vue&type=style&index=0&id=478e47c2&lang=stylus&scoped=true

Syntax Error: HookWebpackError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: EACCES: permission denied, open '/home/main_user/.config/postcssrc'
-- inner error --
Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: EACCES: permission denied, open '/home/main_user/.config/postcssrc'
Generated code for /home/main_user/projects/my_project/node_modules/css-loader/dist/cjs.js??clonedRuleSet-37.use[1]!/home/main_user/projects/my_project/node_modules/vue-loader/dist/stylePostLoader.js!/home/main_user/projects/my_project/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-37.use[2]!/home/main_user/projects/my_project/node_modules/stylus-loader/dist/cjs.js??clonedRuleSet-37.use[3]!/home/main_user/projects/my_project/node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!/home/main_user/projects/my_project/node_modules/vue-loader/dist/index.js??ruleSet[0].use[1]!/home/main_user/projects/my_project/src/components/PromiseForm.vue?vue&type=style&index=0&id=478e47c2&lang=stylus&scoped=true
1 | throw new Error("Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):\nError: EACCES: permission denied, open '/home/main_user/.config/postcssrc'");

Version: vue 3.3.3 (latest released). This was NOT yet an issue with vue 3.2.13.

This problem does ONLY appear if you have NO postcss config present whatsoever. I had deleted my postcss config file because I didn't want any postprocessing, but apparently it cannot really be disabled.

I tried setting various postcss options to disable it entirely, but without success. Setting css.loaderOptions.postcss.postcssOptions.config: false in vue.config.js results in a very obscure error,

 error  in ./src/components/PromiseForm.vue?vue&type=script&lang=coffee

Syntax Error: Thread Loader (Worker 2)
Cannot read properties of null (reading 'content')

but I guess doing that wasn't a great idea anyway. It's possible that this latter error actually comes from coffee-loader. The former not, though, it's reproducible on a new repo.

And finally, I also tried

	config.module
			.rule('vue')
				.use('vue-loader')
				.tap((options) => ({
					...options,
					useConfigFile: false,
				}))

because apparently that's something you could do in vue loader v14 but it doesn't change anything. I guess it was removed again on purpose?

Finally, however, I have found a workaround - setting in package.json

"postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },

allows building without errors. Without this, the error returns. I guess that's not really how this should work?

Thanks!

Edit: Solved by migrating to Vite.

@SimeonDominiq
Copy link

Thank you @phil294 .
This works.

phil294 added a commit to phil294/GitLG that referenced this issue Sep 15, 2024
the package.json postcss thingy is necessary because of my local setup and vuejs/vue-loader#2044
@Stephane-Ag
Copy link

Very odd but adding the following to package.json does seem to resolve the issue! I guess it serves as an alternative to postcss.config.js?

{
  ...
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants