cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
509 stars 83 forks source link

Build instructions seem to be incomplete #16

Closed vittorioromeo closed 3 months ago

vittorioromeo commented 1 year ago

Running mdbook build is not enough, as I get this error message:

2023-02-08 23:41:04 [INFO] (mdbook::book): Book building has started
2023-02-08 23:41:04 [WARN] (mdbook::preprocess::cmd): The command wasn't found, is the "quiz" preprocessor installed?
2023-02-08 23:41:04 [WARN] (mdbook::preprocess::cmd):   Command: mdbook-quiz
2023-02-08 23:41:04 [INFO] (mdbook::book): Running the html backend
2023-02-08 23:41:05 [ERROR] (mdbook::utils): Error: Rendering failed
2023-02-08 23:41:05 [ERROR] (mdbook::utils):    Caused By: Unable to copy across additional CSS and JS
2023-02-08 23:41:05 [ERROR] (mdbook::utils):    Caused By: Unable to copy C:\sync\rust-book\js-extensions/packages/consent-form/dist/index.css to C:\sync\rust-book\book\js-extensions/packages/consent-form/dist/index.css
2023-02-08 23:41:05 [ERROR] (mdbook::utils):    Caused By: The system cannot find the path specified. (os error 3)

I tried running npm install into js-extensions, and also downloaded pnpm and tried running that, but I get this error with pnpm build:

packages/telemetry build$ node build.mjs
│ Error: spawn tsc ENOENT
│     at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
│     at onErrorNT (node:internal/child_process:476:16)
│     at processTicksAndRejections (node:internal/process/task_queues:82:21) {
│   errno: -4058,
│   syscall: 'spawn tsc',
│   path: 'tsc',
│   spawnargs: [ '-emitDeclarationOnly' ]
│ }
└─ Failed in 444ms at C:\sync\rust-book\js-extensions\packages\telemetry
packages/consent-form build$ node build.mjs
└─ Running...
C:\sync\rust-book\js-extensions\packages\telemetry:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  telemetry@0.1.0 build: `node build.mjs`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

What is the correct way of building this book?

vittorioromeo commented 1 year ago

Note: had to change cp.spawn("tsc", opts) to cp.spawn("tsc.cmd", opts) in rust-book\js-extensions\node_modules\@nota-lang\esbuild-utils\dist to make it work on Windows.

vittorioromeo commented 1 year ago

Even after installing mdbook-quiz with cargo, I get this error on mdbook build:

Node.js v18.12.1
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'spellchecker'
Require stack:
- C:\Users\vromeo5\AppData\Local\Temp\.tmpsJ2VW5.cjs
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (C:\Users\vromeo5\AppData\Local\Temp\.tmpsJ2VW5.cjs:44:12656)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\vromeo5\\AppData\\Local\\Temp\\.tmpsJ2VW5.cjs' ]
}
willcrichton commented 1 year ago

Hi yes, the build is a little underdocumented at this point since we're rapidly changing features. You need to npm install -g spellechecker to get the spellchecker. In general, the CI action is the only source of truth right now.

nk9 commented 5 months ago

Just tried running the instructions with the cargo make flavor, and it also fails:

$ cargo make install
[cargo-make] INFO - cargo make 0.37.7
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Project: rust-book
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: install
[cargo-make] INFO - Profile: development
[cargo-make] ERROR - Task install not found
[cargo-make] WARN - Build Failed.

When you say "the CI action", do you mean the GitHub Action workflow? Afer running the command above, mdbook still isn't found, so I guess I need to manually install the binaries?

willcrichton commented 3 months ago

Ah sorry it should be cargo make build (I will fix this in the README).