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

Build failed #6166

Closed
semyin opened this issue Dec 18, 2021 · 5 comments · Fixed by #6177
Closed

Build failed #6166

semyin opened this issue Dec 18, 2021 · 5 comments · Fixed by #6177
Labels
bug: upstream Bug in a dependency of Vite

Comments

@semyin
Copy link

semyin commented Dec 18, 2021

Describe the bug

I installed according to the example on the official website, and there was an error when packaging.

Reproduction

clone this repo https:/semyin/vite-build-error
run

npm install

npm run build

System Info

npx: installed 1 in 2.08s

  System:
    OS: macOS 12.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Memory: 772.09 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
    npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.110
    Firefox: 95.0
    Safari: 15.2
  npmPackages:
    @vitejs/plugin-vue: ^2.0.0 => 2.0.1 
    vite: ^2.7.2 => 2.7.3 


### Used Package Manager

npm

### Logs

```shell
/Users/semyin/.nvm/versions/node/v12.18.0/bin/node /Users/semyin/.nvm/versions/node/v12.18.0/lib/node_modules/npm/bin/npm-cli.js run build --scripts-prepend-node-path=auto

> [email protected] build /Users/semyin/Desktop/workspace/myself/space-admin-vue3
> vue-tsc --noEmit && vite build

/Users/semyin/Desktop/workspace/myself/space-admin-vue3/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40
        return this._head?.value;
                          ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:1054:16)
    at Module._compile (internal/modules/cjs/loader.js:1102:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/semyin/Desktop/workspace/myself/space-admin-vue3/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-tsc --noEmit && vite build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/semyin/.npm/_logs/2021-12-18T06_32_04_353Z-debug.log

Process finished with exit code 1



### Validations

- [X] Follow our [Code of Conduct](https:/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https:/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https:/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] 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:/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https:/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@ygj6
Copy link
Member

ygj6 commented Dec 18, 2021

vuejs/language-tools#737

vue-tsc's dependency require node version 14

@ygj6 ygj6 added bug: upstream Bug in a dependency of Vite and removed pending triage labels Dec 18, 2021
@semyin
Copy link
Author

semyin commented Dec 18, 2021

johnsoncodehk/volar#737

vue-tsc's dependency require node version 14

https://vitejs.dev/guide/#scaffolding-your-first-vite-project

image

But the documentation is outdated.

Thanks.

@Niputi
Copy link
Contributor

Niputi commented Dec 18, 2021

it's not incorrect. vite itself does require v12+

@Shinigami92
Copy link
Member

But could be that vite supports node 12.20+ and here we have 12.18

@bluwy
Copy link
Member

bluwy commented Dec 19, 2021

It looks like optional chaining is only supported in node 14, so 12.20 likely won't work too. I'm with @Niputi here, Vite itself requires v12+, vue-tsc requires v14+. So the end user would need node 14 for it to work.

I think we can update the documentation though to clear up that the templates may requires node 14 and above.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants