latticexyz / opcraft

https://opcraft.mud.dev
GNU General Public License v3.0
114 stars 43 forks source link

Error when installing to run locally on Windows WSL 2 with Ubuntu 20.04 distro #68

Closed claudioantonio closed 1 year ago

claudioantonio commented 1 year ago

I tried the installation using the following LTS versions of node v16.0.0, v16.10.0, v18.13.0 and v18.14.0. All yarn execution failed a the same point of the installation. Below you have the full log of execution. Any hint?

$ yarn
yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["aabb-3d@github:fenomas/aabb-3d"] is trying to unpack in the same destination "/home/claudio/.cache/yarn/v6/npm-aabb-3d-0.2.1/node_modules/aabb-3d" as pattern ["aabb-3d@fenomas/aabb-3d"]. This could result in non-deterministic behavior, skipping.
[3/4] Linking dependencies...
warning "@typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning "workspace-aggregator-6554f31c-f32f-414a-8e57-ee4ab57f9e6c > client > @latticexyz/phaserx@1.31.2" has incorrect peer dependency "phaser@3.60.0-beta.14".
warning "workspace-aggregator-6554f31c-f32f-414a-8e57-ee4ab57f9e6c > client > @latticexyz/std-client@1.31.2" has incorrect peer dependency "phaser@3.60.0-beta.14".
warning "workspace-aggregator-6554f31c-f32f-414a-8e57-ee4ab57f9e6c > contracts > @nomicfoundation/hardhat-chai-matchers@1.0.4" has incorrect peer dependency "@nomiclabs/hardhat-ethers@^2.0.0".
warning "workspace-aggregator-6554f31c-f32f-414a-8e57-ee4ab57f9e6c > client > @latticexyz/utils > typedoc-plugin-markdown@3.14.0" has unmet peer dependency "typedoc@>=0.23.0".
[4/4] Building fresh packages...
$ husky install && (forge --version || yarn foundryup) && yarn lerna run prepare
husky - Git hooks installed
/bin/sh: 1: forge: not found
yarn run v1.22.19
$ curl -L https://foundry.paradigm.xyz | bash && bash ~/.foundry/bin/foundryup
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1825  100  1825    0     0   3642      0 --:--:-- --:--:-- --:--:--  3642
Installing foundryup...
######################################################################## 100.0%

Detected your preferred shell is bash and added foundryup to PATH. Run 'source /home/claudio/.bashrc' or start a new terminal session to use foundryup.
Then, simply run 'foundryup' to install Foundry.

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

 ╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦         Portable and modular toolkit
 ╠╣  ║ ║ ║ ║ ║║║  ║║ ╠╦╝ ╚╦╝    for Ethereum Application Development
 ╚   ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═  ╩                 written in Rust.

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

Repo       : https://github.com/foundry-rs/
Book       : https://book.getfoundry.sh/
Chat       : https://t.me/foundry_rs/
Support    : https://t.me/foundry_support/
Contribute : https://github.com/orgs/foundry-rs/projects/2/

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

foundryup: installing foundry (version nightly, tag nightly-3861b3f7d6e173cf709e4a99c1584db92fbd6c63)
foundryup: downloading latest forge, cast, anvil, and chisel
################################################################################################################# 100.0%
foundryup: downloading manpages
################################################################################################################# 100.0%
foundryup: installed - forge 0.2.0 (3861b3f 2023-02-14T00:04:02.369811784Z)
foundryup: warning:
There are multiple binaries with the name 'forge' present in your 'PATH'.
This may be the result of installing 'forge' using another method,
like Cargo or other package managers.
You may need to run 'rm ' or move '/home/claudio/.foundry/bin'
in your 'PATH' to allow the newly installed version to take precedence!
foundryup: installed - cast 0.2.0 (3861b3f 2023-02-14T00:04:02.369811784Z)
foundryup: warning:
There are multiple binaries with the name 'cast' present in your 'PATH'.
This may be the result of installing 'cast' using another method,
like Cargo or other package managers.
You may need to run 'rm ' or move '/home/claudio/.foundry/bin'
in your 'PATH' to allow the newly installed version to take precedence!
foundryup: installed - anvil 0.1.0 (3861b3f 2023-02-14T00:04:42.24566469Z)
foundryup: warning:
There are multiple binaries with the name 'anvil' present in your 'PATH'.
This may be the result of installing 'anvil' using another method,
like Cargo or other package managers.
You may need to run 'rm ' or move '/home/claudio/.foundry/bin'
in your 'PATH' to allow the newly installed version to take precedence!
foundryup: installed - chisel 0.1.1 (3861b3f 2023-02-14T00:04:42.171854916Z)
foundryup: warning:
There are multiple binaries with the name 'chisel' present in your 'PATH'.
This may be the result of installing 'chisel' using another method,
like Cargo or other package managers.
You may need to run 'rm ' or move '/home/claudio/.foundry/bin'
in your 'PATH' to allow the newly installed version to take precedence!
foundryup: done
Done in 12.74s.
yarn run v1.22.19
$ /home/claudio/src/opcraft/node_modules/.bin/lerna run prepare
lerna notice cli v4.0.0
lerna info Executing command in 1 package: "yarn run prepare"
lerna ERR! yarn run prepare exited 1 in 'contracts'
lerna ERR! yarn run prepare stdout:
$ chmod u+x git-install.sh && mud types
Compiling contracts
Clearing forge build output directory ./out
Cmd:
forge build -o ./out
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run prepare stderr:
node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: spawn forge ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:283:19)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:289:12)
    at onErrorNT (node:internal/child_process:476:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn forge',
  path: 'forge',
  spawnargs: [ 'build', '-o', './out' ]
}

Node.js v18.14.0
error Command failed with exit code 1.
lerna ERR! yarn run prepare exited 1 in 'contracts'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
claudioantonio commented 1 year ago

Solved!

The steps to install and run opcraftwere done using VSCode's terminal:

  1. clone opcraft repo
  2. change dir to the folder created for opcraft
  3. type code . to open VSCodeeditor
  4. open a terminal on VSCode
  5. follow instruction on the READMEfile to run it locally
  6. open your browser and http://localhost:3000

After that I tried running it again using only the Ubuntu terminal and it also worked! In summary, after it run the first time, it seems to always run. 🤨