create-wasm-app: [cloning template failed] npm init wasm-app

I just tried to create an instance of create-wasm-app by executing npm init wasm-app. I was expecting the project initialization to succeed. Instead, I got this error log:

~/Development/accept  npm init wasm-app
npx: installed 1 in 2.048s
cloning the template failed!

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 2
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

apparently you’re supposed to provide the project name as an argument to npm init, eg.:

$ npm init wasm-app foo
npx: installed 1 in 2.211s
🦀 Rust + 🕸 Wasm = ❤

That seems to work fine, relevant code below:

if (process.argv.length >= 3) {
  folderName = process.argv[2];
  if (!fs.existsSync(folderName)) {
    fs.mkdirSync(folderName);
  }
}

const clone = spawn("git", ["clone", "https://github.com/rustwasm/create-wasm-app.git", folderName]);

Should we update the docs accordingly in order to reflect that? I can send a quick PR.

I found that this wasn’t working for me because I had git configured to use a proxy. Running git config --global --unset http.proxy before npm init wasm-app www fixed it for me.

FWIW, I don’t think that’s the core issue, since I’ve have never had git configured to use a proxy.

The script for cloning the project is fairly simple.

Given the fact that this bug has existed since 2018 and still isn’t fixed, I have to disagree with that assessment. It may look simple, but if it really was then the issue would have been fixed long ago. Rather it looks like there’s some subtleties that are being overlooked somehow.

It also reminds me of the recently-introduced term builder gloves.

I don’t mean to bash anyone, especially not the devs of this project, but the fact that this seemingly trivial issue seems to be causing so much pain to so many people might be an indication that the CLI command’s current terminal interface is far from intuitive, and likely to be suboptimal.

From first principles, it both surprises and bugs me that this is somehow tied up into npm init rather than being it’s own, clean, unambiguous, documented and easy to use CLI command.

Compare this to using e.g. Cargo, which Just Works™ generally speaking. Meanwhile I’m fairly certain that what cargo does is far more complex than the rustwasm project creation CLI command that seems to be causing so much confusion and pain.

#84

I’ve made a pull request to display the error messages from git (since git is used in the implementation of npm init wasm-app) so that the error messages are actually useful for working out what went wrong when it fails.

same problem