Comments (16)
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.
from create-wasm-app.
same problem
from create-wasm-app.
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.
from create-wasm-app.
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.
from create-wasm-app.
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
beforenpm 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.
from create-wasm-app.
Do you have git
on your machine?
from create-wasm-app.
Of course! What kind of dev doesn't these days? :)
from create-wasm-app.
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
from create-wasm-app.
@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.
from create-wasm-app.
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 = ❤
from create-wasm-app.
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.
from create-wasm-app.
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
from create-wasm-app.
@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.
from create-wasm-app.
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).
from create-wasm-app.
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.
from create-wasm-app.
Had the same issue - just like RKennedy9064 commented, updating git (from 1.7.x to 2.26.2) fixed the issue for me.
from create-wasm-app.
Related Issues (20)
- Validate whether if Git is installed in advance
- Need to publish a new release to npm HOT 3
- This module doesn't work with `yarn create` HOT 1
- Minimum Node version HOT 1
- WebAssembly module is included in initial chunk HOT 2
- Tutorial issue section 4.4 HOT 1
- live reload/automatic recompile for wasm lib?
- Support webpack v5 HOT 5
- Prominently describe target use case and link to other templates HOT 1
- Prompt for user's preferred bundler HOT 1
- This module doesn't work anymore HOT 8
- `npm init wasm-app www` fails HOT 5
- express with wasm HOT 2
- mkdirp HOT 1
- create demo gif
- Bump webpack-dev-server to mute npm audit
- Electron bundle
- Which is better performant for rust-wasm?
- Set up CI for this template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from create-wasm-app.