./ node_modules / mapbox-gl / dist / mapbox-gl.css模块构建失败:TypeError:无法读取未定义的属性'toFixed'

问题描述 投票:0回答:1

我已经在React(版本:16.12.0)中集成了Mapbox GL JS(版本:1.8.0),并且工作正常。但是,当我尝试运行build命令时,会抛出以下错误:

./node_modules/mapbox-gl/dist/mapbox-gl.css Module build failed: TypeError: Cannot read property 'toFixed' of undefined at Array.filter (<anonymous>) at Array.filter (<anonymous>) at Array.filter (<anonymous>) at Array.forEach (<anonymous>)

npm ERR!代码ELIFECYCLEnpm ERR! errno 1npm ERR! [email protected]构建:at Array.filter (<anonymous>) at Array.filter (<anonymous>) at Array.filter (<anonymous>) at Array.forEach (<anonymous>)npm ERR!退出状态1npm ERR!npm ERR!在[email protected]构建脚本上失败。npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。npm ERR!代码ELIFECYCLEnpm ERR! errno 1npm ERR! [email protected]登台:react-scripts buildnpm ERR!退出状态1npm ERR!npm ERR!在[email protected]登台脚本上失败。npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。

有人可以告诉我为什么反应生成命令抛出错误而npm start命令没有抛出错误吗?

reactjs mapbox-gl-js
1个回答
0
投票

使用[email protected]进行构建时,我遇到了同样的问题。我升级到了最新版本(v3.4.0),为我解决了此问题。

env-cmd .env.staging npm run build

npm install --save react-scripts@latest
© www.soinside.com 2019 - 2024. All rights reserved.