Skip to content

Error: Cannot resolve custom syntax module "postcss-styled-syntax" #19

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

Closed
Spielboerg opened this issue Aug 28, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@Spielboerg
Copy link

When I run stylelint with postcss-styled-syntax, I get this error message:

$ stylelint .

Error: Cannot resolve custom syntax module "postcss-styled-syntax". Check that module "postcss-styled-syntax" is available and spelled correctly.

Caused by: Error: Cannot find module 'typescript'
Require stack:
- <project-path>/node_modules/@typescript-eslint/typescript-estree/dist/convert.js
- <project-path>/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js
- <project-path>/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
- <project-path>/node_modules/@typescript-eslint/typescript-estree/dist/index.js
- <project-path>/node_modules/postcss-styled-syntax/lib/parse.js
- <project-path>/node_modules/postcss-styled-syntax/lib/index.js
- <project-path>/node_modules/stylelint/lib/getPostcssResult.js
- <project-path>/node_modules/stylelint/lib/lintSource.js
- <project-path>/node_modules/stylelint/lib/standalone.js
    at getCustomSyntax (<project-path>/node_modules/stylelint/lib/getPostcssResult.js:85:11)
    at getPostcssResult (<project-path>/node_modules/stylelint/lib/getPostcssResult.js:32:5)
    at lintSource (<project-path>/node_modules/stylelint/lib/lintSource.js:99:10)
    at async <project-path>/node_modules/stylelint/lib/standalone.js:211:27
    at async Promise.all (index 0)
    at async standalone (<project-path>/node_modules/stylelint/lib/standalone.js:254:22)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Process finished with exit code 1

Note: I replaced the original file paths with <project-path>.

We do not use Typescript in our projects, nor do we want to install it just for stylelint. There is also another issue (#12) related to Typescript.

You can find a minimalistic setup for reproduction here: https://stackblitz.com/edit/stylelint-custom-syntax-error?file=package.json
Steps:

  1. Wait for automatic dependency installation
  2. Run stylelint .
  3. See error from above
@hudochenkov
Copy link
Owner

Thank you for providing a reproduction.

Issues reproduced by using legacy packet manager — Yarn 1 — which doesn't install peer dependencies, unlike npm or pnpm. While this project doesn't directly dependent on typescript package, project dependencies do have peer dependencies on typescript.

I'll take a look how to best address this.

@hudochenkov hudochenkov added the bug Something isn't working label Sep 1, 2023
@hudochenkov
Copy link
Owner

Should be fixed in 0.5.0.

@Spielboerg
Copy link
Author

Yes, thank you @hudochenkov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants