nginxconfig.io icon indicating copy to clipboard operation
nginxconfig.io copied to clipboard

npm run dev -> EACCES: permission denied, open '/.config/postcssrc'

Open mralusw opened this issue 3 years ago • 7 comments

Information

node=16.9.0 from nodesource on Debian 11; npm=8.19.3

Help request

Problem

vue-cli-service serve src/nginxconfig/mount.js, called from npm run dev, tries to write to /.config/..., and from there on everything breaks.

$ git clone https://github.com/digitalocean/nginxconfig.io.git
$ cd nginxconfig.io/
$ npm ci
...
$ npm run dev
...
> [email protected] dev:tool
> vue-cli-service serve src/nginxconfig/mount.js

 INFO  Starting development server...
[95%] emitting (emit)
(node:27926) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API


 ERROR  Failed to compile with 1 error                                                                                            4:17:18 PM

 error  in ./node_modules/prismjs/plugins/toolbar/prism-toolbar.css

Syntax Error: Error: EACCES: permission denied, open '/.config/postcssrc'


Error parsing bundle asset "/zram/user/1000/nginxconfig.io/dist/js/chunk-vendors.js": no such file
...

Note that I'm not requesting an NPM global install or anything like that.

What I have tried

I've tried to check if there's some missing path configuration (i.e. some DIR='' variable would explain the attempted acccess to $DIR/.config/... resolving to /.config/...). I couldn't find it.

mralusw avatar Jan 03 '23 14:01 mralusw

We don't do anything custom with postcss, this sounds like an upstream issue with Vue's CLI service, or something specific to your local installation/config of Node and your system.

MattIPv4 avatar Jan 03 '23 14:01 MattIPv4

Thanks for the prompt response. I've bisected it to 895d448. That's where the EACCESS error starts to appear. Before that commit, it runs without errors.

mralusw avatar Jan 03 '23 15:01 mralusw

I've also tried nodejs=18.12.1-deb-1nodesource1 as recommended by nodejs.org. Same error, also starting at 895d448 (with node 18 I also get an EBADENGINE Unsupported engine during npm install, which seemingly doesn't matter).

mralusw avatar Jan 03 '23 17:01 mralusw

I had the similar error in a project and could fix either by disable the automatic configuration of the postcss loader in the webpack config file (in my case the vue.config.js):

module.exports = { ... css: { ... loaderOptions: { postcss: { postcssOptions: { config: false } } } }

or by creating a simple postcss configuraton file in the project root directory postcss.config.js :

module.exports = {};

jonaswjs avatar Feb 09 '23 16:02 jonaswjs

Nice one @jonaswjs :^)

drik98 avatar Feb 09 '23 16:02 drik98

When your system is Linux, and your code is on a disk with an NTFS partition, you may encounter this issue, which can be resolved using the method provided by @jonaswjs 。

Possibly, adding support for ntfs-3g could also solve the problem?

Haberia-ski avatar Jul 16 '24 08:07 Haberia-ski

When your system is Linux, and your code is on a disk with an NTFS partition, you may encounter this issue, which can be resolved using the method provided by @jonaswjs 。

Possibly, adding support for ntfs-3g could also solve the problem?

Haberia-ski avatar Jul 16 '24 08:07 Haberia-ski