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

bit build failed: dev+vue.dev-services.linter.v_zh54tchgb56oqy7unumk5ggzty\node_modules\@bitdev\vue.dev-services.linter.vue-eslint-config\dist\index.js': Cannot find module '@typescript-esdev+vue.dev-services.linter.v_zlint/eslint-plugin' #9112

Closed
subham25997 opened this issue Aug 12, 2024 · 19 comments

Comments

@subham25997
Copy link

With latest version of Bit,

  • I created a workspace using cmd:

bit new vue my-workspace --env bitdev.vue/vue-env --default-scope my-org.my-scope

  • Run bit install --add-missing-deps
  • Create a component using bit create vue ui/component
  • when I try bit build, I am getting the following error:

image

Specifications

  • Bit version: 1.8.20
  • Node version: 20.16.0
  • npm version: 10.8.1
@subham25997
Copy link
Author

I tried installing @typescript-eslint/eslint-plugin also. But it didn't work

@Jinjiang
Copy link
Member

@subham25997 sorry I can't reproduce it. May I have more information like the bit envs result and the forkFrom data in .bitmap?

For mine which doesn't reproduce:

$ bit envs
┌─────────────────────────────────────┬───────────────────────────────────┐
│ component                           │ env                               │
├─────────────────────────────────────┼───────────────────────────────────┤
│ my-org.my-scope/envs/my-vue-env     │ bitdev.general/envs/[email protected] │
├─────────────────────────────────────┼───────────────────────────────────┤
│ my-org.my-scope/envs/my-vue-wrapper │ bitdev.vue/[email protected]          │
├─────────────────────────────────────┼───────────────────────────────────┤
│ my-org.my-scope/ui/my-first         │ my-org.my-scope/envs/my-vue-env   │
└─────────────────────────────────────┴───────────────────────────────────┘
{
    "envs/my-vue-env": {
        // ...
        "forkedFrom": {
            "scope": "bitdev.vue",
            "name": "examples/my-vue-env",
            "version": "1.1.3"
        }
    },
    "envs/my-vue-wrapper": {
        // ...
        "forkedFrom": {
            "scope": "bitdev.vue",
            "name": "examples/my-vue-wrapper",
            "version": "1.1.2"
        }
    },
    // ...
}

Thanks.

@subham25997
Copy link
Author

subham25997 commented Aug 13, 2024

For me, bit envs gives:

┌─────────────────────────────────────────────┬────────────────────────────────────┐
│ component                                   │ env                                │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
│ suite360/composables/[email protected] │ suite360/envs/[email protected]     │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/core/[email protected]          │ suite360/envs/[email protected]     │
│ suite360/core/[email protected]          │ suite360/envs/[email protected]     │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/core/[email protected]           │ suite360/envs/[email protected]     │
├─────────────────────────────────────────────┼────────────────────────────────────┤
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/core/[email protected]              │ suite360/envs/[email protected]     │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/envs/[email protected]              │ bitdev.general/envs/[email protected] │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/envs/[email protected]          │ bitdev.vue/[email protected]           │
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/envs/[email protected]          │ bitdev.vue/[email protected]           │
├─────────────────────────────────────────────┼────────────────────────────────────┤
├─────────────────────────────────────────────┼────────────────────────────────────┤
│ suite360/layouts/[email protected]       │ suite360/envs/[email protected]     

In .bitmap, it looks like:

"envs/my-vue-env": {
        "name": "envs/my-vue-env",
        "scope": "suite360",
        "version": "0.0.3",
        "mainFile": "index.ts",
        "rootDir": "suite360/envs/my-vue-env"
    },
    "envs/my-vue-wrapper": {
        "name": "envs/my-vue-wrapper",
        "scope": "suite360",
        "version": "0.0.2",
        "mainFile": "index.ts",
        "rootDir": "suite360/envs/my-vue-wrapper"
    },

@Jinjiang
Copy link
Member

It looks fine. May I see bit show suite360/envs/my-vue-env and the code in ./config/eslintrc.cjs in that env component?

@subham25997
Copy link
Author

subham25997 commented Aug 13, 2024

@Jinjiang Please find it below:

bit show suite360/envs/my-vue-env

id               │ suite360/envs/[email protected]                                        │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ scope            │ suite360                                                              │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ name             │ envs/my-vue-env                                                       │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ env              │ bitdev.general/envs/[email protected]                                    │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ package name     │ @suite360/envs.my-vue-env                                             │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ deprecated       │ false                                                                 │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ forking          │ origin: bitdev.vue/examples/[email protected]                          │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ main file        │ index.ts                                                              │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ files            │ env.jsonc                                                             │
│                  │ index.ts                                                              │
│                  │ my-vue-env.bit-env.ts                                                 │
│                  │ my-vue-env.docs.mdx                                                   │
│                  │ config\eslintrc.cjs                                                   │
│                  │ config\prettier.config.cjs                                            │
│                  │ config\tsconfig.json                                                  │
│                  │ config\vite.config.mjs                                                │
│                  │ config\vitest.config.mjs                                              │
│                  │ preview\docs.tsx                                                      │
│                  │ preview\mounter.tsx                                                   │
│                  │ config\types\types.d.ts                                               │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ dev files        │ my-vue-env.docs.mdx (teambit.docs/docs)                               │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ aspects          │ bitdev.general/envs/[email protected]                                    │
│                  │ teambit.component/dev-files                                           │
│                  │ teambit.component/forking                                             │
│                  │ teambit.compositions/compositions                                     │
│                  │ teambit.dependencies/dependency-resolver                              │
│                  │ teambit.docs/docs                                                     │
│                  │ teambit.envs/envs                                                     │
│                  │ teambit.harmony/application                                           │
│                  │ teambit.pipelines/builder                                             │
│                  │ teambit.pkg/pkg                                                       │
│                  │ teambit.preview/preview                                               │
│                  │ teambit.semantics/schema                                              │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ dependencies     │ @babel/[email protected] (package)   │
│                  │ @mdx-js/[email protected] (package)   │
│                  │ @mdx-js/[email protected] (package)   │
│                  │ @teambit/[email protected] (package)   │
│                  │ @teambit/[email protected] (package)   │
│                  │ @testing-library/vue@^8.0.3------------------------------ (package)   │
│                  │ @types/[email protected] (package)   │
│                  │ @types/[email protected] (package)   │
│                  │ @types/react-dom@^18.2.5--------------------------------- (package)   │
│                  │ @vitejs/plugin-vue@^5.1.2-------------------------------- (package)   │
│                  │ @vitest/coverage-v8@^2.0.3------------------------------- (package)   │
│                  │ @bitdev/[email protected] (component) │
│                  │ @bitdev/[email protected] (component) │
│                  │ @bitdev/[email protected] (component) │
│                  │ @bitdev/[email protected] (component) │
│                  │ @bitdev/[email protected] (component) │
│                  │ @bitdev/[email protected] (component) │
│                  │ @bitdev/[email protected] (component) │
│                  │ core-js@^3.36.1------------------------------------------ (package)   │
│                  │ [email protected] (package)   │
│                  │ eslint-plugin-vitest@^0.5.4------------------------------ (package)   │
│                  │ [email protected] (package)   │
│                  │ jsdom@^24.0.0-------------------------------------------- (package)   │
│                  │ less@^4.2.0---------------------------------------------- (package)   │
│                  │ [email protected] (package)   │
│                  │ [email protected] (package)   │
│                  │ sass@^1.62.1--------------------------------------------- (package)   │
│                  │ @suite360/[email protected] (component) │
│                  │ @teambit/[email protected] (component) │
│                  │ @teambit/[email protected] (component) │
│                  │ @teambit/[email protected] (component) │
│                  │ @teambit/[email protected] (component) │
│                  │ @teambit/[email protected] (component) │
│                  │ @teambit/[email protected] (component) │
│                  │ vite@^5.3.4---------------------------------------------- (package)   │
│                  │ vitest@^2.0.3-------------------------------------------- (package)   │
│                  │ vue@^3.2.45---------------------------------------------- (package)   │
│                  │ vuetify@^3.6.14------------------------------------------ (package)   │
├──────────────────┼───────────────────────────────────────────────────────────────────────┤
│ dev dependencies │ @types/[email protected] (package)             │
│                  │ @types/[email protected] (package)             │
│                  │ @bitdev/[email protected] (component)           │
│                  │ @teambit/[email protected] (component)           │
└──────────────────┴───────────────────────────────────────────────────────────────────────┘

./config/eslintrc.cjs

image

@subham25997
Copy link
Author

When I do bit install --add-missing-deps, I am getting this as well

image

@itaymendel
Copy link
Contributor

After creating your component, please run bit install and then try and see if it is working.
If it is not, please run bit status. in case you see any error, rerun with bit status --log and share here the error printed.

@Jinjiang
Copy link
Member

@itaymendel agree.


@subham25997 addition to the errors on your last screenshot: it's fine during the process. the thing you need to check is

  1. whether the installation completes at the end with a message like Successfully installed dependencies and compiled X component(s) in XXX seconds
  2. bit status after the installation completes.

and sometimes a fully re-installation helps:

rm -r node_modules pnpm-lock.yaml
bit install
bit ws-config write
bit status

If you found any Bit command failed, the --log error argument will help us to collect information to further analyze.

Thanks.

@subham25997
Copy link
Author

I tried and bit install was successful. Also, bit status doesn't show any issues. But I am getting this error on bit build

image

@Jinjiang
Copy link
Member

Jinjiang commented Aug 14, 2024

I see. Seems this time the error message was different. Would you mind bit build --log error again to check the full error log? Thanks.

Update: this error message seems probably a Windows-specific issue. I'll try to reproduce it again 🤔

@subham25997
Copy link
Author

I got this after running bit build --log error:

image

@subham25997
Copy link
Author

subham25997 commented Aug 14, 2024

@Jinjiang Please follow below steps to reproduce the issue:

  • Delete .bvm folder from your system.
  • Now install bvm and bit using npm install -g @teambit/bvm and bvm install
  • Create a vue workspace using:
    bit new vue my-workspace --env bitdev.vue/vue-env --default-scope my-org.my-scope
  • Create a vue component and run bit build

@Jinjiang
Copy link
Member

Jinjiang commented Aug 15, 2024

I think I've reproduced it on my Windows. I will try to solve it and keep you posted. 🙏

Update: If you want to proceed before it on Windows, maybe you can work on your workspace in the WSL environment.

Thanks.

@Jinjiang
Copy link
Member

From what I've tried, there is a hack to make it works:

  1. run bit build --log error to get the error stack, find the file node_modules\.pnpm\xxx\@eslint\eslintrc\dist\eslintrc.cjs
  2. goto line: L2345 (should be function resolve(moduleName, relativeToPath) { ... })
    • explain: here the relativeToPath sometimes is \C:\xxx on Windows which should be C:\xxx. so:
  3. add if (relativeToPath.match(/^\\C\:/)) { relativeToPath = relativeToPath.replace(/^\\C\:/, "C:") } at the beginning of the function.
  4. save and run bit build and the task should be completed without errors.

That's what I've debugged so far.

/cc @GiladShoham since the trigger I've found is inside the package @eslint/eslintrc, I'm still not quite sure how to avoid it through our side. maybe you have some ideas?

Thanks.

@Jinjiang
Copy link
Member

@subham25997 bitdev.vue/vue-env v1.1.3 should work as expected. to upgrade, I guess you need to:

  1. bit envs update bitdev.vue/vue-env
  2. for suite360/envs/my-vue-env, change this line of code:
    dirname(new URL(import.meta.url).pathname) into dirname(fileURLToPath(import.meta.url)) and at the same time add import { fileURLToPath } from 'url' at the top. (example)

Thanks.

@subham25997
Copy link
Author

Thank you @Jinjiang it's working. But I am getting another issue when I do bit start:

Preview for components is not working
image
image

@Jinjiang
Copy link
Member

Jinjiang commented Aug 16, 2024

I see. I think there are 2 issues:

  1. for the terminal error: you might need to update the package @teambit/vite.pre-bundles.react.ui.docs-app to the latest. Go to my-vue-env/env.jsonc to edit it should be from v0.0.2 to v0.0.5.
  2. for the browser console error: I will take a further look. (Did it happen previously?)

Thanks.

@subham25997
Copy link
Author

@Jinjiang Yes the second issue started when I updated my bit to the latest version.

@subham25997
Copy link
Author

Closing this issue and have created a new issue #9122 for component previews not loading.

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

No branches or pull requests

3 participants