WebpackError: #95313 Gatsby Building failed



我查找了许多线程,但找不到与此相关的线程,所以我在这里询问。我基本上使用@drei依赖项在我的gatsby站点中添加了一个GLTF文件(我在Sushi.jsx中声明了这个文件)。在我的本地开发服务器上,一切都很好:gatsby-develop或gatsby-build没有错误。但在我的ubuntu液滴上,它总是抛出这个WebpackError:#95313。我不确定这是与3D模型有关,还是只是@drei本身的转换错误。。

ERROR #95313 
Building static HTML failed
See our docs page for more info on this error: https://gatsby.dev/debug-html

12 | }
13 |
> 14 | const createImageUrl = (blob, type) => URL.createObjectURL(new
Blob([fixBinary(atob(blob))], {
| ^
15 |   type
16 | }));
17 |

WebpackError: ReferenceError: Blob is not defined

- base64.js:14 
node_modules/drei/helpers/base64.js:14:1

- cloud.base64.js:4 
node_modules/drei/assets/cloud.base64.js:4:32

- Cloud.js:1 
node_modules/drei/Cloud.js:1:1

- index.js:1 
node_modules/drei/index.js:1:1

- Sushi.jsx:1 
src/components/Sushi/Sushi.jsx:1:1

- Hero.jsx:1 
src/components/Hero/Hero.jsx:1:1

- App.jsx:1 
src/components/App.jsx:1:1

- index.js:1 
src/pages/index.js:1:1

My dependencies are down here: 
"dependencies": {
"bootstrap": "^4.5.0",
"drei": "^2.2.21",
"gatsby": "^2.23.7",
"gatsby-image": "^2.4.7",
"gatsby-plugin-manifest": "^2.4.12",
"gatsby-plugin-offline": "^3.2.11",
"gatsby-plugin-react-helmet": "^3.3.4",
"gatsby-plugin-sass": "^2.3.4",
"gatsby-plugin-sharp": "^2.6.12",
"gatsby-source-filesystem": "^2.3.12",
"gatsby-transformer-sharp": "^2.3.16",
"nanoid": "^3.1.10",
"node-sass": "^4.14.1",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-bootstrap": "^1.0.1",
"react-dom": "^16.13.1",
"react-github-btn": "^1.2.0",
"react-helmet": "^6.1.0",
"react-native-animated-emoji": "^0.1.4",
"react-reveal": "^1.2.2",
"react-scroll": "^1.7.16",
"react-spring": "^8.0.27",
"react-three-fiber": "^5.1.4",
"react-tilt": "^0.1.4",
"react-typewriter-effect": "^1.0.2",
"three": "^0.122.0",
"typewriter-effect": "^2.17.0"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.4",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.+(js|jsx)": [
"eslint --fix",
"git add"
],
"*.+(json|css|md)": [
"prettier --write",
"git add"
]
}
}

根据:

Node.js v15.0.1。在液滴Node.js v12.19.0上。在我的本地系统上

这导致依赖关系版本不匹配。在v12.19.0下运行和工作的显然不在v15.0.1中。

在两种环境中使用相同的Node版本(至少是主版本)。如果本地机器中的一个正在工作,请在两侧使用v12.19.0。或者,您可以在本地计算机中使用v15.0.1,修复问题,然后推动修复。

使用NVM(节点版本管理器)帮助您使用节点版本:

nvm install 12.19.0
nvm use 12.19.0

最新更新