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

在Deepin V23系统下, npm start 启动报错: "Error: EACCES: permission denied, open '/.config/postcssrc'" #11374

Open
engcn opened this issue Oct 18, 2024 · 1 comment

Comments

@engcn
Copy link

engcn commented Oct 18, 2024

🧐 问题描述 | Problem description

在Deepin V23系统下, 从官网安装的Ant design pro示例,使用的npm i安装的依赖, 然后启动报权限错误, 使用sudo npm start启动正常;
npm start 启动报错: "Error: EACCES: permission denied, open '/.config/postcssrc'"

在Ubuntu 24.04 LTS系统下,即使用普通用户也可以正常启动; 看来跟系统有关?

💻 示例代码 | Sample code

从官网正常安装的Ant design pro示例, 一行代码都没有改:

npm i @ant-design/pro-cli -g
pro create antd-test
cd antd-test
npm i
npm start

🚑 其他信息 | Other information

npm start启动错误日志:

> [email protected] start
> cross-env UMI_ENV=dev max dev

😄  Hello PRO
info  - [你知道吗?] 全局布局用 layout ,多层布局用 wrappers ,从文档了解更多路由的控制方法,详见 https://umijs.org/docs/guides/routes
Mako https://makojs.dev is a new fast Rust based bundler from us, which is heavily optimized for umi and much faster than webpack. Visit https://makojs.dev/docs/getting-started#bundle-with-umi for more details if you want to give it a try.
Using openapi Plugin
info  - Umi v4.3.27
info  - Preparing...
        ╔════════════════════════════════════════════════════╗
        ║ App listening at:                                  ║
        ║  >   Local: http://localhost:8000                  ║
ready - ║  > Network: http://192.168.0.5:8000                ║
        ║                                                    ║
        ║ Now you can open browser with the above addresses↑ ║
        ╚════════════════════════════════════════════════════╝

Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader.js):
HookWebpackError: Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js):
Error: EACCES: permission denied, open '/.config/postcssrc'
    at tryRunOrWebpackError (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:77383:9)
    at __webpack_require_module__ (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62253:12)
    at __nested_webpack_require_153795__ (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62210:18)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62281:20
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
    at done (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40459:9)
    at Hook.eval [as callAsync] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:15:1)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62188:43
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40414:9)
    at timesSync (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:39229:7)
    at Object.eachLimit (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40395:5)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62153:16
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
    at timesSync (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:39229:7)
    at Object.eachLimit (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40395:5)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62121:15
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
    at done (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40459:9)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62068:8
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:60547:32
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:77363:3
    at _done (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:9:1)
    at Hook.eval [as callAsync] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:39:22)
    at Cache.store (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52335:20)
    at ItemCacheFacade.store (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52538:15)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:60547:11
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52313:6
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52267:11
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:97633:9
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52316:6
    at eval (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:30:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
-- inner error --
Error: Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js):
Error: EACCES: permission denied, open '/.config/postcssrc'
    at Object.<anonymous> (/mnt/soft/antd-test/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[1]!/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js??ruleSet[1].rules[4].oneOf[1].use[2]!/mnt/soft/antd-test/src/.umi/plugin-layout/Layout.css:1:7)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:131315:10
    at Hook.eval [as call] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7460), <anonymous>:7:1)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62255:39
    at tryRunOrWebpackError (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:77378:7)
    at __webpack_require_module__ (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62253:12)
    at __nested_webpack_require_153795__ (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62210:18)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62281:20
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
    at done (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40459:9)
    at Hook.eval [as callAsync] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:15:1)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62188:43
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40414:9)
    at timesSync (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:39229:7)
    at Object.eachLimit (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40395:5)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62153:16
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
    at timesSync (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:39229:7)
    at Object.eachLimit (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40395:5)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62121:15
    at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
    at done (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40459:9)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62068:8
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:60547:32
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:77363:3
    at _done (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:9:1)
    at Hook.eval [as callAsync] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:39:22)
    at Cache.store (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52335:20)
    at ItemCacheFacade.store (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52538:15)
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:60547:11
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52313:6
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52267:11
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:97633:9
    at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52316:6
    at eval (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), <anonymous>:30:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Generated code for /mnt/soft/antd-test/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[4].oneOf[1].use[1]!/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js??ruleSet[1].rules[4].oneOf[1].use[2]!/mnt/soft/antd-test/src/.umi/plugin-layout/Layout.css
1 | throw new Error("Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js):\nError: EACCES: permission denied, open '/.config/postcssrc'");
Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader.js):
HookWebpackError: Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js):

ant-design相关版本:

ant-design-pro version:  6.0.0
dependencies
    "@ant-design/icons": "^4.8.1",
    "@ant-design/pro-components": "^2.6.48",
    "@ant-design/pro-cli": "^3.3.0",

OS version:

Deepin V23 release版

系统内核详细信息:

Linux my 6.9.6-amd64-desktop-rolling # 23.01.01.02 SMP PREEMPT_DYNAMIC Tue Jul 23 12:20:02 CST 2024 x86_64 GNU/Linux

Node version:

v20.11.1

npm version:

10.9.0

浏览器 | browser:

不需要浏览器, 在命令行下都无法启动

@engcn
Copy link
Author

engcn commented Oct 23, 2024

找到原因了:
'/.config'该目录属于root用户, 700权限
drwx------ 3 root root 4096 8月20日 22:28 .config

临时解决办法:
sudo chmod 705 /.config

疑问:
为什么要读取系统根目录下的/.config/postcssrc, 不应该读取系统当前用户下 ~/.config/postcssrc吗?

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

1 participant