Open tomorrow307 opened 1 year ago
Is the problem solved?I'm having the same issue.
Please Download This : https://download.scratch.mit.edu/microbit/scratch-microbit.hex.zip
I also encountered this issue in China and cannot open this address. How to solve it, thank you
if Browser download, please use this link:if browser download
Guys, Greetings from China, I solved it by manually downloading and extracting hex file plus a few lines of code modification.
Here are the steps:
const downloadMicrobitHex = async () => {
const relativeHexDir = path.join('static', 'microbit');
const hexFileName = "scratch-microbit-1.2.0.hex"
const relativeHexFile = path.join(relativeHexDir, hexFileName);
const relativeGeneratedDir = path.join('src', 'generated');
const relativeGeneratedFile = path.join(relativeGeneratedDir, 'microbit-hex-url.cjs');
const absoluteGeneratedDir = path.join(basePath, relativeGeneratedDir);
fs.mkdirSync(absoluteGeneratedDir, {recursive: true});
const absoluteGeneratedFile = path.join(basePath, relativeGeneratedFile);
fs.writeFileSync(
absoluteGeneratedFile,
[
'// This file is generated by scripts/prepublish.mjs',
'// Do not edit this file directly',
'// This file relies on a loader to turn this `require` into a URL',
`module.exports = require('./${path.relative(relativeGeneratedDir, relativeHexFile)}');`,
'' // final newline
].join('\n')
);
console.info(`Wrote ${relativeGeneratedFile}`);
};
@tomorrow307 @dbgoa @little8jie
2. microbit
thanks, i do it and solve the problem
牛
@JiafengLiao thanks!
excellent solution!
上边的朋友说得对,遇到这个问题的基本都是中国的,翻墙软件似乎并不能让npm翻墙 就是用浏览器下载https://downloads.scratch.mit.edu/microbit/scratch-microbit.hex.zip 加压后放在static\microbit\scratch-microbit-1.2.0.hex 最后修改scripts\prepublish.mjs中的downloadMicrobitHex函数代码看上边那个朋友的
按照上面给出的方案,可以正常运行成功;但是我在运行 npm start 启动的时候,报错: ERROR in ./src/generated/microbit-hex-url.cjs Module not found: Error: Can't resolve './....staticmicrobitscratch-microbit-1.2.0.hex' in 'D:\Scratch\Scratch-Testing\scratch-gui\src\generated' 请问有没有什么好的解决方案?
按照上面给出的方案,可以正常运行成功;但是我在运行 npm start 启动的时候,报错: ERROR in ./src/generated/microbit-hex-url.cjs Module not found: Error: Can't resolve './....staticmicrobitscratch-microbit-1.2.0.hex' in 'D:\Scratch\Scratch-Testing\scratch-gui\src\generated' 请问有没有什么好的解决方案?
是完全按照步骤来的吗?看起来像是路径问题
@Applewan generated/microbit-hex-url.cjs module.exports = require('./../../static/microbit/scratch-microbit-1.2.0.hex');
还是没有解决,该怎么办
按照上面给出的方案,可以正常运行成功;但是我在运行 npm start 启动的时候,报错: ERROR in ./src/generated/microbit-hex-url.cjs Module not found: Error: Can't resolve './....staticmicrobitscratch-microbit-1.2.0.hex' in 'D:\Scratch\Scratch-Testing\scratch-gui\src\generated' 请问有没有什么好的解决方案?
最后您是怎么解决的
按照上面给出的方案,可以正常运行成功;但是我在运行 npm start 启动的时候,报错: ERROR in ./src/generated/microbit-hex-url.cjs Module not found: Error: Can't resolve './....staticmicrobitscratch-microbit-1.2.0.hex' in 'D:\Scratch\Scratch-Testing\scratch-gui\src\generated' 请问有没有什么好的解决方案?
最后您是怎么解决的
报错是啥
Hello! My issue is followed: ERROR in ./src/lib/microbit-update.js Module not found: Error: Can't resolve '../generated/microbit-hex-url.cjs' in 'E:\scratch-gui\src\lib' @ ./src/lib/microbit-update.js 12:0-55 84:23-29 @ ./src/containers/connection-modal.jsx @ ./src/components/gui/gui.jsx @ ./src/containers/gui.jsx @ ./src/playground/player.jsx Child HtmlWebpackCompiler: Asset Size Chunks Chunk Names child-HtmlWebpackPlugin_0 4.62 KiB HtmlWebpackPlugin_0 HtmlWebpackPlugin_0 Entrypoint HtmlWebpackPlugin_0 = child-HtmlWebpackPlugin_0 [./node_modules/html-webpack-plugin/lib/loader.js!./src/playground/index.ejs] 599 bytes {HtmlWebpackPlugin_0} [built] i 「wdm」: Failed to compile.
May I ask how you can solve this problem.
4. scripts\prepublish.mjs
looks like the path is not correctly set. For those who encountered "Can't resolve '****/microbit-hex-url.cjs'" problem. Please check your code in 'scripts\prepublish.mjs' with the code snippet I post. And check if microbit-hex-url.cjs stored in the path 'src/generate/'
module.exports = require('./....\static\microbit\scratch-microbit-1.2.0.hex'); 这句中的“\”改成“/”,如下: module.exports = require('./../../static/microbit/scratch-microbit-1.2.0.hex');
是否有高端一点的解法,scratch-desktop也报该问题,却没有相关的script去修改。
我本人有梯子,且设置了命令行代理(设置了http_proxy https_proxy all_proxy),能够通过wget https://downloads.scratch.mit.edu/microbit/scratch-microbit.hex.zip 下载到该文件。
但是,执行npm install 的时候依然报错,真是日了狗了。
npm ERR! FetchError: request to https://downloads.scratch.mit.edu/microbit/scratch-microbit.hex.zip failed, reason: connect ETIMEDOUT 156.233.67.243:443
npm ERR! at ClientRequest.
@wudaochen Hello, I met the same error with yours. May I know have you addressed it?
- scripts\prepublish.mjs
looks like the path is not correctly set. For those who encountered "Can't resolve '****/microbit-hex-url.cjs'" problem. Please check your code in 'scripts\prepublish.mjs' with the code snippet I post. And check if microbit-hex-url.cjs stored in the path 'src/generate/'
Downloading https://downloads.scratch.mit.edu/microbit/scratch-microbit.hex.zip FetchError: request to https://downloads.scratch.mit.edu/microbit/scratch-microbit.hex.zip failed, reason: connect ETIMEDOUT 162.125.32.10:443 at ClientRequest. (D:\lxj\myelectron\scratch\scratch-gui\node_modules\cross-fetch\node_modules\node-fetch\lib\index.js:1491:11)
at ClientRequest.emit (node:events:369:20)
at TLSSocket.socketErrorListener (node:_http_client:472:9)
at TLSSocket.emit (node:events:369:20)
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:81:21) {
type: 'system',
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT'
}
npm ERR! code 1
npm ERR! path D:\lxj\myelectron\scratch\scratch-gui
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/prepublish.mjs
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\lxj\AppData\Local\npm-cache_logs\2023-06-20T08_28_43_088Z-debug.log