cloudflare / cloudflare/workers-rs

[BUG] Too many positional arguments provided

Open
#392 0 comments 5 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.7k
Forks
429
Avg merge
20h 28m
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### What version of `workers-rs` are you using?

N/A

### What version of `wrangler` are you using?

`wrangler 3.9.1`

### Describe the bug

In the README,

> ## Getting Started
>
> The project uses [wrangler](https://github.com/cloudflare/wrangler2) version 2.x for running and publishing your Worker.
>
> Get the Rust worker project [template](https://github.com/cloudflare/workers-sdk/tree/main/templates/experimental/worker-rust) manually, or run the following command:
> ```bash
> npm init cloudflare project_name worker-rust
> cd project_name
> ```

So I tried it, but the error like below occurred.

#### Steps To Reproduce

1. Run the below command.
```sh
$ docker run node:20.7 npm init -y cloudflare project_name worker-rust
```

#### Expected result

It should generate worker project for `worker-rs`.

#### Actual result

```sh
create-cloudflare [args]

Positionals:
name [string]

Options:
--type [string]
--framework [string]
--deploy [boolean]
--ts [boolean]
--git [boolean]
--open opens your browser after your deployment, set --no-open
to disable [boolean] [default: true]
-y, --accept-defaults [boolean]
--version Show version number [boolean]
-h, --help Show help [boolean]

Too many positional arguments provided
npm ERR! code 1
npm ERR! path /
npm ERR! command failed
npm ERR! command sh -c create-cloudflare project_name worker-rust

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-09-26T05_33_21_329Z-debug-0.log
```

Seems like `create-cloudflare` does not support generating templates or the README is outdated.

I tried something like `npm init cloudflare@latest --type worker-rust` but it keeps saying `type` is `undefined`.

```sh
├ What type of application do you want to create?
│ type undefined
```

#### Note

In the [template repository](https://github.com/cloudflare/workers-sdk/tree/main/templates/experimental/worker-rust), it say I have to use one of the followings:

> ## Setup
>
> To create a `my-project` directory using this template, run:
>
> ```sh
> $ npx wrangler generate my-project https://github.com/cloudflare/workers-sdk/templates/experimental/worker-rust
> # or
> $ yarn wrangler generate my-project https://github.com/cloudflare/workers-sdk/templates/experimental/worker-rust
> # or
> $ pnpm wrangler generate my-project https://github.com/cloudflare/workers-sdk/templates/experimental/worker-rust
> ```

So I tried it as well, and this time, it worked. However it shows warning like this:

```sh
⛅️ wrangler 3.9.1
------------------
▲ [WARNING] The `generate` command is no longer supported and will be removed in a future version.
```

I am new to cloudflare worker, so I have no idea which one is the correct one.

Thank you for working on this awesome project.

Regards.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.