95% emittingFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 1: no

95% emittingFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node_module_register
2: v8::internal::Factory::NewRawTwoByteString
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! [email protected] dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! F:\Program Files\nodejs\node_cache_logs\2019-04-03T08_36_25_025Z-debug.log

这个报错的意思就是Node内存不足所导致的。
window系统下解决办法:
在\node_modules.bin\webpack-dev-server.cmd文件中添加 “–max_old_space_size=2048” //2048的单位为M,表示node最大占用内存数值,可以根据实际情况自行调整数值
在这里插入图片描述
从"–max_old_space_size=2048" 到"–max_old_space_size=4096"
问题仍然没有解决,频繁出现此种情况,项目太大,导致内存溢出,npm install -g increase-memory-limit (increase-memory-limit 后面据说可能是我扩容了,但是我没有执行)
npm run serve 再次重启

以上一大堆都是废话,都是我经历的不堪回首的道路。 一点效果都没有。装完之后,不一会有报内存溢出,我真是太难了!!
脑子一热,我把node卸载了,重新下载了node 。新版本的node已经是12.14了,原来的版本是10.15.3, 装好新的node,很好,有出现了新的错误,这下启动都启动不了了。
Node Sass could not find a binding for your current environment: OS X 64-bit with Node 0.10.x

Found bindings for the following environments:

OS X 64-bit with Node.js 6.x
This usually happens because your environment has changed since running npm install.
Run npm rebuild node-sass to build the binding for your current environment.
在这里插入图片描述
各种办法都试了,按照上面指示,重装了npm rebuild node-sass,结果这货是github上的,这段时间github都基本打不开,还想下载东西,,痴心妄想了。 百度搜了各种,试了各种,甚至都想重装系统了!!
无奈删除了node_modules文件夹,然后:
重新安装vue-cli npm i -g vue-cli 第一步没有报错,
然后yarn install (之所以用yarn 是因为这个项目npm install 经常会缺失某些依赖。)把依赖重装,第二步也没报错。
重启,居然好了。。。
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈

猜你喜欢

转载自blog.csdn.net/weixin_43764828/article/details/103631331