node.js - 在 npm run start 后构建卡在 91%
问题描述
当我执行 npm run start 时,突然出现了这个错误。该项目是用 ant-design pro 构建的。可悲的是,它没有告诉我错误在哪里。你能帮我找出错误或修复它吗?构建只是卡在 91%,然后我收到错误消息。
这是错误:
build [================== ] 91%(node:6978) UnhandledPromiseRejectionWarning: RangeError: Invalid string length
at formatError (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Stats.js:223:30)
at Array.map (<anonymous>)
at Stats.toJson (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Stats.js:230:31)
at Compiler.<anonymous> (/home/teks/trips/may26th/smarttrips_react/node_modules/html-webpack-plugin/index.js:68:44)
at Compiler.applyPluginsAsyncSeries (/home/teks/trips/may26th/smarttrips_react/node_modules/tapable/lib/Tapable.js:206:13)
at Compiler.emitAssets (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Compiler.js:354:8)
at onCompiled (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Compiler.js:58:19)
at applyPluginsAsync.err (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/Compiler.js:510:14)
at next (/home/teks/trips/may26th/smarttrips_react/node_modules/tapable/lib/Tapable.js:202:11)
at Compiler.<anonymous> (/home/teks/trips/may26th/smarttrips_react/node_modules/webpack/lib/CachePlugin.js:78:5)
at next (/home/teks/trips/may26th/smarttrips_react/node_modules/tapable/lib/Tapable.js:204:14)
at /home/teks/trips/may26th/smarttrips_react/node_modules/hard-source-webpack-plugin/index.js:2075:7
at <anonymous>
(node:6978) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6978) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
编辑:我还将我的 npm 更新到版本 6,但仍然收到相同的错误消息。请指教。
解决方案
可能是因为本地主机没有在系统的“主机”文件中使用所需的语法定义。该文件可以位于@:
linux
etc/hosts
视窗
c:\ **Windows** \System32\Drivers\ **etc** \ **hosts**
即文件有一些错误的输入。
因此,尝试用下面的文本替换该文件中的所有内容,因为这是正常工作时主机文件中始终存在的默认文本:
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
推荐阅读
- python - 如何在 Pandas 中将两个不同数据框的交替行组合成一个数据框?
- java - 在 Windows NFS 上移动的不完整文件
- import - 是否有任何 certutil 命令将 .pem 文件导入浏览器信任库?文件导入发生在操作系统上,但未显示在浏览器中
- mqtt - 获取所有消息的 MQTT 代理的订阅者数量
- javascript - 使用参数生成顶部并使用 grep 进行解析
- javascript - 当我设置它时,我的状态发生了变化,但是通过反应上下文使用此状态值的其他组件没有显示具有新结果的状态
- javascript - 使用 CheerioGS 收集属性内的链接
- python - 将数据框导出到 csv 放样带有标题和日期索引的列
- c# - blazor webassembly - 使用自己的显示/隐藏按钮动态生成 html 对象列表
- c++ - 为什么我会得到一个很大的负数?