CADmium-Co / CADmium

A CAD program that runs in the browser
https://cadmium-co.github.io/CADmium/
Other
1.46k stars 59 forks source link

Compilation failed in win11 terminal #58

Closed huangxiaobao-cxx closed 5 months ago

huangxiaobao-cxx commented 5 months ago

I encountered 3 problems when compiling according to the readme document. The first problem is that when executing the "pnpm dev" command, the console output is as follows: 67b9370acc397c23181621e3a3954a1 Observing the above error, it seems that there is an extra ";" in the command, so I found the "dev" script in "packages/cadmium/package.json" and found that there is indeed an extra ";" in the command. After I deleted it, the error disappeared. But when executing "pnpm dev" again, the second problem appeared: faed259b5755216f5ce34c83eb44c41 The command RUST_BACKTRACE terminal cannot recognize it. After consulting the information, I found that the command is to set the RUST environment variable, but setting the environment variable in the Windows terminal requires "set", so I changed RUST_BACKTRACE=1 to set RUST_BACKTRACE=1, and ran it again, and the error disappeared. After modifying "packages/cadmium/package.json", part of its content is: 11067a486365fb333c20ecae4e22a1d After running "pnpm dev" again, the third problem occurred: the console cannot output UTF-8 text, and the program crashes. Here, you only need to modify the console encoding and execute "chcp 65001". Run "pnpm dev" again and it will be executed successfully. The cadmium web interface is as follows: 1170bd6dbeea9ecb0d379065452738e

av8ta commented 5 months ago

Thanks for the report @huangxiaobao-cxx & glad you got it working!

https://www.npmjs.com/package/cross-env#usage

Shouldn't need set according to cross-env docs. Which terminal are you using?

Also, I don't see the errant ; in the build:dev command here on main

av8ta commented 5 months ago

Found it, the semicolon is on the "dev": "pnpm run build:dev; onchange 'src/**/*.rs' -- pnpm run build:dev", command.

thanks

av8ta commented 5 months ago

@huangxiaobao-cxx please pull from main & close this issue if your problem is solved :pray:

https://github.com/CADmium-Co/CADmium/commit/44b051b26f91b70c5cef6898fcd876ef812ebb74

huangxiaobao-cxx commented 5 months ago

Thanks for the report @huangxiaobao-cxx & glad you got it working!

https://www.npmjs.com/package/cross-env#usage

Shouldn't need set according to cross-env docs. Which terminal are you using?

Also, I don't see the errant ; in the build:dev command here on main

I tested it using cmd, powershell, and bash terminals, but still couldn't run "pnpm dev" and it would prompt that RUST_BACKTRACE could not be recognized

huangxiaobao-cxx commented 5 months ago

From the website https://www.npmjs.com/package/cross-env#usage, I found that the "cross-env" instruction sets the environment variables at the beginning, so I tried to modify the script and change the "build:dev" instruction from build:dev: cross-env cargo check && RUST_BACKTRACE=1 wasm-pack build --no-pack --target web --dev to build:dev: cross-env RUST_BACKTRACE=1 cargo check && wasm-pack build --no-pack --target web --dev After the modification, executing "pnpm dev" can run successfully

av8ta commented 5 months ago

@huangxiaobao-cxx Please try this: "build:dev": "cross-env cargo check && set RUST_BACKTRACE=1 wasm-pack build --no-pack --target web --dev",

huangxiaobao-cxx commented 5 months ago

@huangxiaobao-cxx Please try this: "build:dev": "cross-env cargo check && set RUST_BACKTRACE=1 wasm-pack build --no-pack --target web --dev",

Yes, that works successfully!. @av8ta You can also try this: "build:dev": "cross-env RUST_BACKTRACE=1 cargo check && wasm-pack build --no-pack --target web --dev", this also works successfully! thanks!

av8ta commented 5 months ago

@MattFerraro you're on apple? Assume pnpm dev runs fine like this on main branch? All good on linux & windows.

MattFerraro commented 5 months ago

yes, pnpm dev works for me on my M1 macbook!