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

Error: Dynamic require of "tty" is not supported #31

Closed
4 tasks done
ianzone opened this issue Dec 13, 2022 · 9 comments
Closed
4 tasks done

Error: Dynamic require of "tty" is not supported #31

ianzone opened this issue Dec 13, 2022 · 9 comments

Comments

@ianzone
Copy link

ianzone commented Dec 13, 2022

描述问题

failed to load config from /home/ian/acte/roomzz-v1/admin_ts/vite.config.ts
error when starting dev server:
Error: Dynamic require of "tty" is not supported
at file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite-plugin-stylelint@4.0.1_hdr6qhp2cp4t47liatlblyjedi/node_modules/vite-plugin-stylelint/dist/index.js:1:376
at file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite-plugin-stylelint@4.0.1_hdr6qhp2cp4t47liatlblyjedi/node_modules/vite-plugin-stylelint/dist/index.js:1:853
at file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite-plugin-stylelint@4.0.1_hdr6qhp2cp4t47liatlblyjedi/node_modules/vite-plugin-stylelint/dist/index.js:1:491
at file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite-plugin-stylelint@4.0.1_hdr6qhp2cp4t47liatlblyjedi/node_modules/vite-plugin-stylelint/dist/index.js:1:2468
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadConfigFromBundledFile (file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite@4.0.1_p56klvi3zg3u723wp3set4h7pe/node_modules/vite/dist/node/chunks/dep-2285ba4f.js:63052:21)
at async loadConfigFromFile (file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite@4.0.1_p56klvi3zg3u723wp3set4h7pe/node_modules/vite/dist/node/chunks/dep-2285ba4f.js:62937:28)
at async resolveConfig (file:///home/ian/acte/roomzz-v1/admin_ts/node_modules/.pnpm/vite@4.0.1_p56klvi3zg3u723wp3set4h7pe/node_modules/vite/dist/node/chunks/dep-2285ba4f.js:62558:28)
 ELIFECYCLE  Command failed with exit code 1.

复现

my vite.config.ts setting is

import react from "@vitejs/plugin-react-swc";
import { resolve } from 'path';
import eslintPlugin from 'vite-plugin-eslint';
import stylelintPlugin from 'vite-plugin-stylelint';
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
globals: true,
environment: 'happy-dom',
},
plugins: [
react(),
stylelintPlugin(),
eslintPlugin()
],
resolve: {
alias: {
src: resolve(__dirname, 'src'),
},
},
});

系统信息

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 5.60 GB / 7.69 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 18.12.0 - ~/.local/share/pnpm/node
    npm: 8.19.2 - ~/.local/share/pnpm/npm

使用的包管理器

pnpm

核对

  • 遵循我们的 行为准则
  • 检查是否已经有一个报告相同错误的问题,以避免重复创建。
  • 这是一个具体的错误。请开启 GitHub 讨论你的疑问。
  • 所提供的复现是这个问题的 最小复现
@PodaruDragos
Copy link

Stumbled upon this and wanted to add that this is happening in a fresh vite v4 project.

@felixranesberger
Copy link

I'm facing the same issue with Vite@3 and Vite@4.

Workarround:
When using vite-plugin-stylelint with Vite@4 and vite-plugin-stylelint@3.3.3 the installation process throws a warning but still functions correclty.

@ModyQyW
Copy link
Owner

ModyQyW commented Dec 13, 2022

Can you please try v4.0.2? @ianzone @PodaruDragos @felixranesberger

Dynamic require is a doom to me, really...

@felixranesberger
Copy link

Hi, thanks for your fast response.
What version do I need to install?

The latest version of Vite is currently 4.0.1

Do you mean 4.0.0-beta.2?

@ModyQyW
Copy link
Owner

ModyQyW commented Dec 13, 2022

vite-plugin-stylelint v4.0.2 actually

@felixranesberger
Copy link

Works like a charm, thanks for the help!

@ModyQyW
Copy link
Owner

ModyQyW commented Dec 14, 2022

@ianzone @PodaruDragos Can you please try the new version of vite-plugin-stylelint and tell me if it is fine? Thanks!

@ianzone
Copy link
Author

ianzone commented Dec 14, 2022

@ianzone @PodaruDragos Can you please try the new version of vite-plugin-stylelint and tell me if it is fine? Thanks!

HI, it works perfectly, THX

@ianzone ianzone closed this as completed Dec 14, 2022
@PodaruDragos
Copy link

@ModyQyW works fine with 4.0.4, thanks for the quick fix, really appreciated it.

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

4 participants