在npm运行开始后,构建卡住了91%

时间:2018-05-31 17:47:48

标签: node.js reactjs antd

当我执行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但仍然收到相同的错误消息。请指教。

2 个答案:

答案 0 :(得分:0)

好吧,我一直在寻找,现在我发现了一个问题,帮助了我。 基本上,将此代码添加到我的package.json是帮助我的。

"start": "HARD_SOURCE=none npm run _start", "_start": "cross-env ESLINT=none roadhog dev",

我无法理解为什么用中文写的, 无论如何,这里是github问题的链接,因为它可能会帮助你们中的一些人理解错误。 antdesign github issue fixed here

答案 1 :(得分:0)

可能是因为 localhost 没有用系统“主机” 文件中的必需语法定义。 该文件可以位于@:

linux

etc/hosts

Windows

c:\ **Windows** \System32\Drivers\ **etc** \ **hosts**

即文件输入错误。

因此,请尝试使用下面的文本替换该文件中的所有内容,因为这是 hosts 文件中总是可以正常使用的默认文本:

127.0.0.1   localhost

255.255.255.255 broadcasthost

::1             localhost

fe80::1%lo0 localhost