Can't install sample project
See original GitHub issueVerify canary release
- I verified that the issue exists in the latest Next.js canary release
Provide environment information
% npx --no-install next info
npm ERR! canceled
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2022-08-04T11_46_58_425Z-debug-0.log
OS: MacOS Monterey 12.5 npm: 8.15.0 Node.js: 18.7.0
Which example does this report relate to?
blog-starter
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
Trouble with first install with npx create-next-app --example blog-starter
.
Error message is this.
Downloading files for example blog-starter. This might take a moment.
? Could not download "blog-starter" because of a connectivity issue between your machine and GitHub.
✔ Could not download "blog-starter" because of a connectivity issue between your machine and GitHub.
Do you want to use the default template instead? … no
Aborting installation.
Unexpected error. Please report it as a bug:
DownloadError: Premature close
at createApp (/Users/username/.npm/_npx/efeac22998af9bf2/node_modules/create-next-app/dist/index.js:317:17028)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async run (/Users/username/.npm/_npx/efeac22998af9bf2/node_modules/create-next-app/dist/index.js:317:23064)
Expected Behavior
It worked fine when the Node version was 16.16.0.
In 18.7.0, I think there is a bug around the sample installation.
To Reproduce
OS: MacOS Monterey 12.5
$ brew install n
$ sudo n latest
// latest version is 18.7.0
$ sudo n use
> 18.7.0
$ npx create-next-app --example blog-starter blog-starter-app
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Unable to Install Setup file of Setup Project
Right-click on your Setup1 project and click View>>Launch Conditions to open following screenshot page, then you can right-click on .NET Framework node to ......
Read more >Install Project - Microsoft Support
See how to install Project 2013 and 2016 and Project Pro for Office 365.
Read more >Cannot install UE5 City Sample on external drive "nto enough ...
There's over 1tb of space available on the E drive where I want to install it but it refuses to do it because...
Read more >Sample Projects Will Not Compile...new installation
I have just installed MPLAB X IDE Beta 4.0 and C18 on Linux (Ubuntu 10.10). None of the Sample Projects will compile. Errors...
Read more >i started a new project and tried to install Multiplayer Samples ...
i started a new project and tried to install Multiplayer Samples Utilities package but it just gave me a ton of errors.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any node version
< 18
will work. Thanks to @jeferson-sb we know that the issue is in node-tar. He has opened an issue here. The issue is that node-tarextract()
emits theclose
event. Which when in a pipeline causes it to error due to premature close in the newer node versions.@SukkaW Indeed weird, although this is enough to reproduce the issue:
To fix this in
create-next-app
, I’ve tried replacingnode-tar
withtar-fs
, but it has a long-standing PR https://github.com/mafintosh/tar-fs/pull/46 that prevents me from moving the extracted files to the top-level.A workaround I can see is to catch the
ERR_STREAM_PREMATURE_CLOSE
error and not throw it in Node 18, as the files actually seems to be extracted correctly.