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

SSR:Error: ENOENT: no such file or directory, open 'xxx/src/views/module.tsx' #3120

Closed
KellerLong opened this issue Apr 24, 2021 · 8 comments

Comments

@KellerLong
Copy link

Describe the bug

in ssr render fail.
error info:

error info
Pre-bundling dependencies:
vue
vue-router
vue-decorator
(this will be run only when your dependencies or config have changed)
[Error: ENOENT: no such file or directory, open 'USERPATH/src/views/module.tsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'USERPATH/src/views/module.tsx'
}
Error: Couldn't resolve component "default" at "/"
at USERPATH/node_modules/vue-router/dist/vue-router.cjs.js:1996:47
at async render (USERPATH/src/entry-server.ts:8:4)

Reproduction

bug store: https://github.com/KellerLong/vue-fix

System Info

windows(wsl 1.0)
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

npx: installed 1 in 2.328s

 
  System:
    OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 3.69 GB / 15.90 GB
    Container: Yes
    Shell: 5.4.2 - /usr/bin/zsh
  Binaries:
    Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v12.13.0/bin/yarn
    npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^1.2.1 => 1.2.1
    vite: ^2.2.1 => 2.2.1

Used package manager: yarn

Logs

babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packag
es/babel#babelhelpers
babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: https://github.com/rollup/plugins/tree/master/packag
es/babel#babelhelpers
Pre-bundling dependencies:
vue
vue-router
vue-decorator
(this will be run only when your dependencies or config have changed)
[Error: ENOENT: no such file or directory, open '/mnt/c/Users/kevin/Projects/test/vue-fix/src/views/module.tsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/mnt/c/Users/kevin/Projects/test/vue-fix/src/views/module.tsx'
}
Error: Couldn't resolve component "default" at "/"
at /mnt/c/Users/kevin/Projects/test/vue-fix/node_modules/vue-router/dist/vue-router.cjs.js:1998:47
at async render (/mnt/c/Users/kevin/Projects/test/vue-fix/src/entry-server.ts:8:10)
at async /mnt/c/Users/kevin/Projects/test/vue-fix/server/app.js:36:29


Before submitting the issue, please make sure you do the following

  • [ *] Read the Contributing Guidelines.
  • [ *] Read the docs.
  • [ *] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [ *] Provide a description in this issue that describes the bug.
  • [ *] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • [ *] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
@KellerLong
Copy link
Author

vesion below 2.0.3 is no problem

@KellerLong
Copy link
Author

expectation: acceleration,Come on, gogogo

@KellerLong
Copy link
Author

solved

@Shinigami92
Copy link
Member

solved

It is really helpful for other folks to read a "how was it solved" when they searching for the same issue.
So maybe you could explain a bit how you solved it 🙂

@KellerLong
Copy link
Author

This problem is not the cause of vite, it is the cause of typescript configuration, because jsx-vue does not support decorators and adds typescript and babel plugins. In fact, vite itself supports ts and babel, so you only need to add babel to decorators. Just support it. No need to introduce additional typescript plugins

@KellerLong
Copy link
Author

If someone encounters the same problem and has not solved it in the way mentioned above, you can comment here

@guguji5
Copy link

guguji5 commented May 7, 2021

my project can run npm run dev' without error. but npm run build` show error as below.
@KellerLong could you help with this ?

image

@KellerLong
Copy link
Author

my project can run npm run dev' without error. but npm run build` show error as below.
@KellerLong could you help with this ?

image

This question has nothing to do with the discussion

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants