@alxia/create 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,278 @@
1
+ # Troubleshooting
2
+
3
+ Each entry is headed by the text you see: what `create-alxia` printed, what
4
+ Bun or the shell printed before it ran, or — for a trap that prints
5
+ nothing — the symptom.
6
+
7
+ **Before it runs**
8
+
9
+ - [`error: GET https://registry.npmjs.org/@alxia%2fcreate - 404`](#error-get-httpsregistrynpmjsorgalxia2fcreate---404)
10
+ - [`env: bun: No such file or directory`](#env-bun-no-such-file-or-directory)
11
+
12
+ **The command line**
13
+
14
+ - [`create-alxia: unknown template vue: use api or react-router.`](#create-alxia-unknown-template-vue-use-api-or-react-router)
15
+ - [`create-alxia: --template needs a template: api or react-router.`](#create-alxia---template-needs-a-template-api-or-react-router)
16
+ - [`create-alxia: unknown option --yes.`](#create-alxia-unknown-option---yes)
17
+ - [`create-alxia: one directory only, given a and b.`](#create-alxia-one-directory-only-given-a-and-b)
18
+ - [`create-alxia: no directory given, and no terminal to ask in.`](#create-alxia-no-directory-given-and-no-terminal-to-ask-in)
19
+ - [`create-alxia: no --template given, and no terminal to ask in.`](#create-alxia-no---template-given-and-no-terminal-to-ask-in)
20
+ - [`create-alxia: cancelled, nothing written.`](#create-alxia-cancelled-nothing-written)
21
+
22
+ **The directory**
23
+
24
+ - [`create-alxia: my-app is not empty (…), and create-alxia writes only into an empty directory.`](#create-alxia-my-app-is-not-empty--and-create-alxia-writes-only-into-an-empty-directory)
25
+ - [`create-alxia: my-app exists and is not a directory.`](#create-alxia-my-app-exists-and-is-not-a-directory)
26
+
27
+ **Writing the project**
28
+
29
+ - [`create-alxia: create-react-router's … is not what this @alxia/create expects: …`](#create-alxia-create-react-routers--is-not-what-this-alxiacreate-expects-)
30
+ - [`create-alxia: failed: create-react-router exited with 1.`](#create-alxia-failed-create-react-router-exited-with-1)
31
+ - [`create-alxia: failed: …`](#create-alxia-failed-)
32
+ - [`create-alxia: warning: the registry did not answer for …; kept the versions the template ships.`](#create-alxia-warning-the-registry-did-not-answer-for--kept-the-versions-the-template-ships)
33
+ - [`typescript: kept to ^6.0.3 || ^7.0.0, where the newest is 7.0.2; npm's latest, 8.0.0, is outside it`](#typescript-kept-to-603--700-where-the-newest-is-702-npms-latest-800-is-outside-it)
34
+ - [`zod: no release within ^4.2.0; kept ^4.2.0`](#zod-no-release-within-420-kept-420)
35
+ - [`create-alxia: bun install failed; the files are written.`](#create-alxia-bun-install-failed-the-files-are-written)
36
+
37
+ **After**
38
+
39
+ - [The `react-router` project's `docker build` fails](#the-react-router-projects-docker-build-fails)
40
+ - [The project's `@alxia/*` are older than npm's latest](#the-projects-alxia-are-older-than-npms-latest)
41
+
42
+ ## Before it runs
43
+
44
+ ### `error: GET https://registry.npmjs.org/@alxia%2fcreate - 404`
45
+
46
+ **When:** `bun create @alxia` (or `bunx @alxia/create`) is run against a
47
+ registry that has no `@alxia/create`: a mirror or a company registry that
48
+ does not proxy npm's. The URL is that registry's, not npmjs.org's.
49
+
50
+ **Why:** `bun create @alxia` installs `@alxia/create` from the registry Bun
51
+ is configured with, then runs its bin.
52
+
53
+ **Fix:** let the registry proxy npmjs.org, or point Bun at it for this one
54
+ command:
55
+
56
+ ```sh
57
+ BUN_CONFIG_REGISTRY=https://registry.npmjs.org bun create @alxia my-app
58
+ ```
59
+
60
+ ### `env: bun: No such file or directory`
61
+
62
+ **When:** `npm create @alxia` on a machine without Bun. On Linux it reads
63
+ `/usr/bin/env: 'bun': No such file or directory`.
64
+
65
+ **Why:** the bin starts with `#!/usr/bin/env bun`: it runs on Bun, and the
66
+ projects it writes do too.
67
+
68
+ **Fix:** install Bun 1.4.2 or later (`curl -fsSL https://bun.sh/install | bash`),
69
+ then run `bun create @alxia`.
70
+
71
+ ## The command line
72
+
73
+ ### `create-alxia: unknown template vue: use api or react-router.`
74
+
75
+ **When:** `--template` names a template the command does not have, or the
76
+ prompt was answered with one.
77
+
78
+ **Fix:** `--template api` or `--template react-router`. `bun create @alxia
79
+ --help` lists them.
80
+
81
+ ### `create-alxia: --template needs a template: api or react-router.`
82
+
83
+ **When:** `--template` is the last argument, or `--template=` is empty.
84
+ The message names the option as typed: `-t needs a template` for `-t`,
85
+ `--template= needs a template` for the empty form.
86
+
87
+ **Fix:** name one: `bun create @alxia my-app --template api`.
88
+
89
+ ### `create-alxia: unknown option --yes.`
90
+
91
+ **When:** an option the command does not take. It takes `--template`,
92
+ `--no-install` and `--help`; it never asks a question the command line
93
+ answered, so it needs no `--yes`.
94
+
95
+ **Fix:** drop it. With npm, options go after `--`, or npm reads them as
96
+ its own: `npm create @alxia my-app -- --template api`.
97
+
98
+ ### `create-alxia: one directory only, given a and b.`
99
+
100
+ **When:** two arguments that are not options: often a template given
101
+ without `--template`, as in `bun create @alxia my-app api`.
102
+
103
+ **Fix:** `bun create @alxia my-app --template api`.
104
+
105
+ ### `create-alxia: no directory given, and no terminal to ask in.`
106
+
107
+ **When:** no directory on the command line, and standard input is not a
108
+ terminal: a script, CI, a pipe.
109
+
110
+ **Why:** the command asks only where it can; it does not guess a directory.
111
+
112
+ **Fix:** give it: `bun create @alxia my-app --template api`.
113
+
114
+ ### `create-alxia: no --template given, and no terminal to ask in.`
115
+
116
+ **When:** a directory but no `--template`, with no terminal.
117
+
118
+ **Fix:** add `--template api` or `--template react-router`.
119
+
120
+ ### `create-alxia: cancelled, nothing written.`
121
+
122
+ **When:** a question was answered with the end of the input — Ctrl-D, or
123
+ a pipe that closed — before the project was written.
124
+
125
+ **Fix:** run the command again and answer, or give both on the command
126
+ line: `bun create @alxia my-app --template api`. An empty answer takes the
127
+ default in brackets.
128
+
129
+ ## The directory
130
+
131
+ ### `create-alxia: my-app is not empty (…), and create-alxia writes only into an empty directory.`
132
+
133
+ **When:** the directory exists and holds anything, a `.git` or a
134
+ `.DS_Store` included. The message names its first three entries.
135
+
136
+ **Why:** the templates write a `package.json`, a `README.md`, a
137
+ `.gitignore`: overwriting a project's own is never what was meant. Nothing
138
+ was written.
139
+
140
+ **Fix:** another directory, or empty this one. To keep a `.git`, create the
141
+ project beside it and move the files in.
142
+
143
+ ### `create-alxia: my-app exists and is not a directory.`
144
+
145
+ **When:** a file has the name given.
146
+
147
+ **Fix:** another name.
148
+
149
+ ## Writing the project
150
+
151
+ ### `create-alxia: create-react-router's … is not what this @alxia/create expects: …`
152
+
153
+ **When:** the `react-router` template, after `create-react-router` ran.
154
+ The message names the file — `package.json`, `vite.config.ts` or
155
+ `bunfig.toml` — and what was expected of it:
156
+
157
+ - `it is missing`: no `package.json` or `vite.config.ts`;
158
+ - `react-router in its dependencies, and the scripts dev: react-router dev, build: react-router build and a start`;
159
+ - `reactRouter() from "@react-router/dev/vite", called once in plugins: [...]`;
160
+ - `it already imports @alxia/react-router/vite`;
161
+ - `none, and there is one`: a `bunfig.toml` already.
162
+
163
+ **Why:** React Router's template changed since this `@alxia/create` was
164
+ released, and the edits that add alxia check each file before changing it
165
+ rather than write a project that does not start. What was written is
166
+ removed: the target directory is emptied when it was there, removed when
167
+ it was not. A parent directory the command created for it, as `a/b` for
168
+ `a/b/my-site`, stays.
169
+
170
+ **Fix:** run the newest `@alxia/create`, whose edits follow the newest
171
+ template:
172
+
173
+ ```sh
174
+ bunx @alxia/create@latest my-site --template react-router
175
+ ```
176
+
177
+ If that one refuses too, add alxia to React Router's template by hand, as
178
+ [`@alxia/react-router`'s README](https://www.npmjs.com/package/@alxia/react-router)
179
+ shows (`bun add`, `alxia()` in `vite.config.ts`, `start`), and open an
180
+ issue.
181
+
182
+ ### `create-alxia: failed: create-react-router exited with 1.`
183
+
184
+ **When:** the `react-router` template, when `create-react-router` itself
185
+ failed; its own output, just above, says why. Most often the network:
186
+ `bunx` could not fetch it, or it could not fetch React Router's template
187
+ from GitHub.
188
+
189
+ **Fix:** what its output says, then run the command again: what was
190
+ written is removed.
191
+
192
+ ### `create-alxia: failed: …`
193
+
194
+ **When:** any other error while writing the project, with the error's own
195
+ message after `failed:` — most often the file system: `EACCES` writing
196
+ into a directory the user cannot write to, `ENOSPC` with the disk full.
197
+
198
+ **Fix:** what the message names, then run the command again: what was
199
+ written is removed, as above.
200
+
201
+ ### `create-alxia: warning: the registry did not answer for …; kept the versions the template ships.`
202
+
203
+ **When:** a dependency's metadata did not arrive within five seconds, or
204
+ the registry answered with an error. The project is still written, with the
205
+ template's own version for each package named.
206
+
207
+ **Why:** the versions are resolved when the project is written
208
+ ([Versions](guide.md#versions)); without an answer the command keeps what
209
+ the template declares rather than fail. For the `react-router` template
210
+ that is React Router's, whose TypeScript may be older than alxia accepts.
211
+
212
+ **Fix:** once the registry answers, run the command again in an empty
213
+ directory, or move the packages named within alxia's ranges by hand:
214
+ `bun add -d typescript@^7 vite@^8`. Behind a proxy, check `BUN_CONFIG_REGISTRY` or
215
+ `npm_config_registry`, which the command reads.
216
+
217
+ ### `typescript: kept to ^6.0.3 || ^7.0.0, where the newest is 7.0.2; npm's latest, 8.0.0, is outside it`
218
+
219
+ **When:** a notice, not an error: a dependency has a newer major on npm
220
+ than the range alxia's packages accept. Vite, React Router and Zod print
221
+ the same line when it happens to them.
222
+
223
+ **Why:** a major alxia does not accept yet is untested with it: the
224
+ project gets the newest version inside the range.
225
+
226
+ **Fix:** nothing to do. The range widens in a release of alxia's packages
227
+ once the major is tested, and the next `@alxia/create` takes it.
228
+
229
+ ### `zod: no release within ^4.2.0; kept ^4.2.0`
230
+
231
+ **When:** a notice: the registry answered for the package, but none of its
232
+ releases is in the range alxia's packages accept — a registry mirror that
233
+ holds only some versions, most often. The template's own version is kept.
234
+
235
+ **Fix:** check what the registry holds (`bun pm view zod versions`), let
236
+ the mirror fetch the missing ones, or write a version within the range by
237
+ hand after the project is created.
238
+
239
+ ### `create-alxia: bun install failed; the files are written.`
240
+
241
+ **When:** `bun install` exited non-zero in the new project; its output,
242
+ just above, says why. The command exits 1, and lists `bun install` among
243
+ the next steps.
244
+
245
+ **Fix:** what its output says, then `cd my-app && bun install`. The
246
+ project is complete; only `node_modules` is missing.
247
+
248
+ ## After
249
+
250
+ ### The `react-router` project's `docker build` fails
251
+
252
+ **Symptom:** `COPY ./package.json package-lock.json /app/` finds no
253
+ `package-lock.json`, or the image starts and `bun: not found`.
254
+
255
+ **Why:** React Router's `Dockerfile` is kept as its template writes it: on
256
+ Node, installed with npm. Once `start` runs `bun build/server/index.js`,
257
+ it no longer fits.
258
+
259
+ **Fix:** base it on an `oven/bun` image, install with
260
+ `bun install --production`, and make its command
261
+ `bun build/server/index.js`, as
262
+ [`@alxia/react-router`'s guide](https://github.com/softistx/alxia/blob/develop/packages/react-router/docs/guide.md#deploying)
263
+ says.
264
+
265
+ ### The project's `@alxia/*` are older than npm's latest
266
+
267
+ **Symptom:** a fresh project declares `@alxia/core` at `^0.3.0` while npm
268
+ has `0.4.0`.
269
+
270
+ **Why:** alxia's packages are written at the versions the `@alxia/create`
271
+ that ran was published with ([Versions](guide.md#versions)), and a release
272
+ of `@alxia/core` alone does not release a new `@alxia/create`.
273
+
274
+ **Fix:** `bunx @alxia/create@latest` for the newest `@alxia/create`, and in
275
+ an existing project
276
+ `bun add @alxia/core@latest @alxia/client@latest`, reading
277
+ [`@alxia/core`'s upgrading page](https://github.com/softistx/alxia/blob/develop/packages/core/docs/upgrading.md)
278
+ for what a minor changed.
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@alxia/create",
3
+ "version": "0.1.0",
4
+ "description": "Start an alxia app: `bun create @alxia` writes an API with Zod, or React Router's official template served by alxia",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "create-alxia": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "docs",
13
+ "README.md",
14
+ "package.json",
15
+ "LICENSE"
16
+ ],
17
+ "exports": {
18
+ "./package.json": "./package.json"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/softistx/alxia.git",
23
+ "directory": "packages/create"
24
+ },
25
+ "publishConfig": {
26
+ "registry": "https://registry.npmjs.org",
27
+ "access": "public"
28
+ },
29
+ "scripts": {
30
+ "build": "bun run ../../build.ts",
31
+ "test": "bun test src",
32
+ "typecheck": "tsc --noEmit"
33
+ },
34
+ "alxia": {
35
+ "entrypoints": [
36
+ "src/index.ts"
37
+ ]
38
+ },
39
+ "devDependencies": {
40
+ "@alxia/client": "^0.2.1",
41
+ "@alxia/core": "^0.3.1",
42
+ "@alxia/react-router": "^0.2.0",
43
+ "@types/bun": "^1.4.2",
44
+ "zod": "^4.6.5"
45
+ }
46
+ }