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

[cloning template failed] npm init wasm-app #44

Open
jjpe opened this issue Dec 6, 2018 · 16 comments · May be fixed by #52
Open

[cloning template failed] npm init wasm-app #44

jjpe opened this issue Dec 6, 2018 · 16 comments · May be fixed by #52

Comments

@jjpe
Copy link

jjpe commented Dec 6, 2018

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!
@fitzgen
Copy link
Member

fitzgen commented Dec 10, 2018

Do you have git on your machine?

@jjpe
Copy link
Author

jjpe commented Dec 11, 2018

Of course! What kind of dev doesn't these days? :)

@asdfgh11111
Copy link

same problem

@felipecsl
Copy link

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.

@tushartyagi
Copy link

Apparently not. Adding the project name randomly works on my machine. Out of 10 times, it worked only once.

npm: 6.9.0
node: v11.10.1
macos mojave

image

@JonCB
Copy link

JonCB commented Apr 10, 2019

@tushartyagi Looks like cloning the template fails if the directory exists.

Note that your 1 success is the first time you added a folder name. This statement is blatantly not true... i should have looked at your image more carefully. At any rate the above solution (ensuring the directory does not exist) worked for me.

@RKennedy9064
Copy link

I also encountered this issue and thought I'd share what I found. When trying to run the command from the terminal in vscode I got the same error, but when running it from git bash it worked successfully. I've had issues cloning from certain repos before because of TLS issues on Windows and the version of Git I was using. The Git version in vscode is older then the version I have for Git bash. Not sure if this is the cause or not, but here's the output from both cases if anyone is looking into this.

git --version
git version 1.9.2.mysysgit.2

npm init wasm-app www
npx: installed 1 in 2.015s
cloning the template failed!
git --version                                                                 
git version 2.20.1.windows.1

npm init wasm-app www                                                          
npx: installed 1 in 1.896s                                                       
🦀 Rust + 🕸 Wasm = ❤

@olisolomons
Copy link

olisolomons commented May 21, 2019

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.

@olisolomons
Copy link

#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.

@jhessin
Copy link

jhessin commented May 27, 2019

I am having all kinds of issues with this. What am I doing wrong?:

Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
internal/fs/utils.js:461
    throw err;
    ^

Error: ENFILE: file table overflow, open '/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/package.json'
    at Object.openSync (fs.js:431:3)
    at Object.readFileSync (fs.js:333:35)
    at Object.Module._extensions..json (internal/modules/cjs/loader.js:791:22)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/config.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) {
  errno: -23,
  syscall: 'open',
  code: 'ENFILE',
  path: '/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/package.json'
}
Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
(libuv) kqueue(): Too many open files in system
tty.js:89
    throw new ERR_TTY_INIT_FAILED(ctx);
    ^

SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned ENFILE (file table overflow)
    at new WriteStream (tty.js:89:11)
    at createWritableStdioStream (internal/process/stdio.js:155:16)
    at process.getStdout [as stdout] (internal/process/stdio.js:28:14)
    at module.exports (/usr/local/lib/node_modules/npm/node_modules/set-blocking/index.js:2:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
(libuv) kqueue(): Too many open files in system
tty.js:89
    throw new ERR_TTY_INIT_FAILED(ctx);
    ^

SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned ENFILE (file table overflow)
    at new WriteStream (tty.js:89:11)
    at createWritableStdioStream (internal/process/stdio.js:155:16)
    at process.getStdout [as stdout] (internal/process/stdio.js:28:14)
    at module.exports (/usr/local/lib/node_modules/npm/node_modules/set-blocking/index.js:2:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
(libuv) kqueue(): Too many open files in system
tty.js:89
    throw new ERR_TTY_INIT_FAILED(ctx);
    ^

SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned ENFILE (file table overflow)
    at new WriteStream (tty.js:89:11)
    at createWritableStdioStream (internal/process/stdio.js:155:16)
    at process.getStdout [as stdout] (internal/process/stdio.js:28:14)
    at module.exports (/usr/local/lib/node_modules/npm/node_modules/set-blocking/index.js:2:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
(libuv) kqueue(): Too many open files in system
tty.js:89
    throw new ERR_TTY_INIT_FAILED(ctx);
    ^

SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned ENFILE (file table overflow)
    at new WriteStream (tty.js:89:11)
    at createWritableStdioStream (internal/process/stdio.js:155:16)
    at process.getStdout [as stdout] (internal/process/stdio.js:28:14)
    at module.exports (/usr/local/lib/node_modules/npm/node_modules/set-blocking/index.js:2:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
(libuv) kqueue(): Too many open files in system
tty.js:89
    throw new ERR_TTY_INIT_FAILED(ctx);
    ^

SystemError [ERR_TTY_INIT_FAILED]: TTY initialization failed: uv_tty_init returned ENFILE (file table overflow)
    at new WriteStream (tty.js:89:11)
    at createWritableStdioStream (internal/process/stdio.js:155:16)
    at process.getStdout [as stdout] (internal/process/stdio.js:28:14)
    at module.exports (/usr/local/lib/node_modules/npm/node_modules/set-blocking/index.js:2:12)
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npmlog/log.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
Jims-MacBook-Pro:www jhessin$ ls
Jims-MacBook-Pro:www jhessin$ npm init wasm-app www
spawn /bin/sh ENFILE
Jims-MacBook-Pro:www jhessin$ npm -v && node -v
6.9.0
v12.3.1

@olisolomons
Copy link

olisolomons commented May 28, 2019

@jhessin try running git clone https://github.com/rustwasm/create-wasm-app.git from inside the www folder. That's what npm init wasm-app www does anyway.

@jjpe
Copy link
Author

jjpe commented May 28, 2019

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(tm) 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.

@olisolomons
Copy link

@jjpe

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.

Running this npm init command runs a script (create-wasm-app.js). This is equivalent to "it's own [...] easy to use CLI command". The command is already:

  • "clean" and "easy to use": run one command to acheive the task
  • "unambiguous" and "documented": This is a normal way to make a new JavaScript project from a template. See unambigous documentation here.

Compare this to using e.g. Cargo, which Just Works(tm) 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.

The script for cloning the project is fairly simple. Compare it to the slightly more complicated create-express-api. It may be performing a simple task, but because of the way that npm init works (and it makes sense to use npm init in this case) you have to make a script specifically for this scenario, and this script hasn't had as much time put into it or as many people contributing to it as Cargo. The main problem seems to be a lack of helpful error messages which will hopefully be fixed by my aforementioned pull request (#84).

@darkmou5e
Copy link

Looks like npm init wasm-app fails because a git repo is already initialized in the current directory. If a new project name isn't specified the script tries to do git clone https://github.com/rustwasm/create-wasm-app.git . and gets fatal: destination path '.' already exists and is not an empty directory.

@ph-preis
Copy link

ph-preis commented May 8, 2020

Had the same issue - just like RKennedy9064 commented, updating git (from 1.7.x to 2.26.2) fixed the issue for me.

@jjpe
Copy link
Author

jjpe commented May 9, 2020

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.

dak2 added a commit to dak2/rust-wasm that referenced this issue Jan 9, 2023
`npm init wasm-app www`実行時のエラー解消のため

refs. rustwasm/create-wasm-app#44 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.