Phaser 3项目启动报错:无法找到binding文件,求简易解决方案
解决Parcel + Phaser3项目启动的deasync.node缺失问题
距离上次碰项目已经好几个月,好不容易有动力继续开发,之前能正常运行的Phaser3+Parcel项目现在启动报错,找不到deasync.node文件,实在搞不定,求帮忙!
报错日志
> phaser3-parcel-template@1.0.0 start > parcel src/index.html -p 8000 C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\bindings\bindings.js:126 err = new Error( ^ Error: Could not locate the bindings file. Tried: → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\build\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\build\Debug\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\build\Release\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\out\Debug\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\Debug\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\out\Release\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\Release\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\build\default\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\compiled\18.5.0\win32\x64\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\addon-build\release\install-root\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\addon-build\debug\install-root\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\addon-build\default\install-root\deasync.node → C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\lib\binding\node-v108-win32-x64\deasync.node at bindings (C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\bindings\bindings.js:126:9) at Object.<anonymous> (C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\deasync\index.js:30:31) at Module._compile (C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\v8-compile-cache\v8-compile-cache.js:192:30) at Module._extensions..js (node:internal/modules/cjs/loader:1166:10) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:834:12) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\v8-compile-cache\v8-compile-cache.js:159:20) at Object.<anonymous> (C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\src\utils\syncPromise.js:1:79) at Module._compile (C:\Users\USER\AppData\Roaming\npm\node_modules\parcel-bundler\node_modules\v8-compile-cache\v8-compile-cache.js:192:30) { tries: [ 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\build\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\build\\\\Debug\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\build\\\\Release\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\out\\\\Debug\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\Debug\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\out\\\\Release\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\Release\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\build\\\\default\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\compiled\\\\18.5.0\\\\win32\\\\x64\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\addon-build\\\\release\\\\install-root\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\addon-build\\\\debug\\\\install-root\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\addon-build\\\\default\\\\install-root\\\\deasync.node', 'C:\\\\Users\\\\USER\\\\AppData\\\\Roaming\\\\npm\\\\node_modules\\\\parcel-bundler\\\\node_modules\\\\deasync\\\\lib\\\\binding\\\\node-v108-win32-x64\\\\deasync.node' ] }
已尝试的操作
- 重装Visual Studio
- 执行
npm fund - 更新控制台提示的内容
解决步骤(按顺序执行)
- 卸载全局旧版Parcel
打开命令提示符(CMD),输入以下命令回车:npm uninstall -g parcel-bundler - 清理项目本地依赖
进入你的项目文件夹,右键删除node_modules文件夹和package-lock.json文件。 - 安装本地新版Parcel
在项目文件夹的命令提示符里执行:npm install parcel --save-dev - 确认启动命令
打开项目里的package.json文件,找到scripts中的start项,确保内容是:"start": "parcel src/index.html -p 8000" - 启动项目
在项目文件夹的命令提示符里执行:npm start
原因说明
报错是因为全局安装的旧版parcel-bundler和你当前的Node.js版本(18.5.0)不兼容,deasync模块需要对应Node版本编译的二进制文件,旧版Parcel没有适配。换成本地安装的新版Parcel后,会自动适配你的Node版本,解决依赖兼容问题。
内容的提问来源于stack exchange,提问作者Gh0st
相关产品推荐
相关产品推荐

