question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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://github.com/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

> space-admin-vue3@0.0.0 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! space-admin-vue3@0.0.0 build: `vue-tsc --noEmit && vite build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the space-admin-vue3@0.0.0 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://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/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://github.com/vuejs/vue-next instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ygj6commented, Dec 18, 2021

https://github.com/johnsoncodehk/volar/issues/737

vue-tsc’s dependency require node version 14

0reactions
bluwycommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix "build failed, do you want to continue"? In Visual ...
In order to debug you need some code that runs. A failed build means the code cannot be compiled => there is nothing...
Read more >
Building Java project shows error: "Build failed, do you want to ...
Building Java project shows error: "Build failed, do you want to continue?" when the build is actually completed because when I click ...
Read more >
Failed Builds - Visual Studio App Center - Microsoft Learn
There are various reasons why your build could have failed that might be unique to your project. Usually an efficient way to diagnose...
Read more >
Build Failed — but no reason! | Apple Developer Forums
Hi, I'm experiencing weird Xcode behavior. I'm getting "build failed" after some alterations to the code, but Xcode will NOT give me the...
Read more >
Build Failed Podcast - SoundCloud
Play Build Failed Podcast and discover followers on SoundCloud | Stream tracks, albums, playlists on desktop and mobile.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found