Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation failed in win11 terminal #58

Closed
huangxiaobao-cxx opened this issue May 30, 2024 · 9 comments · Fixed by #61
Closed

Compilation failed in win11 terminal #58

huangxiaobao-cxx opened this issue May 30, 2024 · 9 comments · Fixed by #61

Comments

@huangxiaobao-cxx
Copy link
Contributor

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
Copy link
Collaborator

av8ta commented May 30, 2024

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
Copy link
Collaborator

av8ta commented May 30, 2024

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

thanks

@av8ta
Copy link
Collaborator

av8ta commented May 30, 2024

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

44b051b

@huangxiaobao-cxx
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Collaborator

av8ta commented May 30, 2024

@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
Copy link
Contributor Author

@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
Copy link
Collaborator

av8ta commented May 30, 2024

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

@MattFerraro
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants