前面写过公司一个外包开发的crmeb商城项目,在我本地进行安装测死的时候,运行不起来踩坑的经过,主要是node版本问题,因为自己不是专业的前端,对vue不精通,折腾了很久才找到正确的版本,解决了问题.只是简单的记录了问题的解决办法没有记载特别详细的错误详情,很是遗憾.
最近公司又有一个商城项目准备使用crmeb Pro版本.先找到了Pro版本的代码进行本地安装进行功能的修改开发测试,又一次遇到了安装问题.这一次进行下详细的记录,希望对使用crmeb的朋友,特别是新手朋友提供一些帮助.
第一个错误:## npm install报错情况 cb() never called!
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2020-12-16T07_38_47_793Z-debug.log
在网上查找资料,参考了三个木马人的博客,(博客地址:blog.csdn.net/weixin_4329…)
一、清除npm缓存
删除已经安装一部分的node_modules文件夹,执行下面命令行: npm cache clean -force 然后再次安装(npm install)
二、升级node版本
可以直接去node官网下载最新版本,也可以使用node包管理器 n (记得删除已经安装的node_modules文件夹)
三、删除代理
删除已经安装一部分的node_modules文件夹,执行下面命令行: npm config rm proxy npm config rm https-proxy
四.使用cnpm安装
还有一个博客说使用cnpm进行安装,安装方法如下: 在终端安装cnpm: npm install -g cnpm --registry=registry.npm.taobao.org
测试cnpm是否安装好,如果已安装好,在终端输入 cnpm -v
上面检测安装完成后先输入以下命令,清除npm缓存 1.先使用:npm cache verify 2.再使用:npm cache clean(ps:如果运行该命令出错请用下面的)
3.可能需要:npm cache clean --force 好啦,我们可以重新安装了, 使用以下面命令进行安装 cnpm install
好啦,完美解决,可以运行我们的项目了 我还是用的cnpm来运行的,如下
博客地址:(blog.csdn.net/tuo_tuo_guo…)
以上方法经过我本人的亲自尝试,最终的解决办法是更换node版本,我在crmeb的开发文档中找到的截图是node 12版本网址:(doc.crmeb.com/pro_s/pro_s…)
我在使用多商户的时候的版本是14.19.XX
所以我就开始了node版本替换的尝试,从官网提供的12.19.0一直测试到最新的node版本16.18.0 ,那个时间成本及心情是非常的难熬.最终在q.crmeb.com论谈找到了官方技术给的回复.14.16.XX 我最终在电脑上安装了node的14.16.0版本,解决了第一个报错.正确版本截图
第二个错误:安装提示错误:错误详情
gifsicle@5.2.1 postinstall F:\wechat-applet-v3\view\admintwo\node_modules\gifsicle
> node lib/install.js
getaddrinfo ENOENT raw.githubusercontent.com
gifsicle pre-build test failed
compiling from source
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "autoreconf -ivf"
'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�����������
at F:\wechat-applet-v3\view\admintwo\node_modules\bin-build\node_modules\execa\index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 0)
> mozjpeg@7.1.1 postinstall F:\wechat-applet-v3\view\admintwo\node_modules\mozjpeg
> node lib/install.js
getaddrinfo ENOENT raw.githubusercontent.com
mozjpeg pre-build test failed
compiling from source
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "autoreconf -fiv"
'autoreconf' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�����������
at F:\wechat-applet-v3\view\admintwo\node_modules\bin-build\node_modules\execa\index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 0)
> optipng-bin@7.0.1 postinstall F:\wechat-applet-v3\view\admintwo\node_modules\optipng-bin
> node lib/install.js
getaddrinfo ENOENT raw.githubusercontent.com
optipng pre-build test failed
compiling from source
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "./configure --with-system-zlib --prefix="F:\wechat-applet-v3\view\admintwo\node_modules\optipng-bin\vendor" --bindir="F:\wecha
t-applet-v3\view\admintwo\node_modules\optipng-bin\vendor""
'.' �����ڲ����ⲿ���Ҳ���ǿ����еij���
�����������
at F:\wechat-applet-v3\view\admintwo\node_modules\bin-build\node_modules\execa\index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 0)
> pngquant-bin@6.0.1 postinstall F:\wechat-applet-v3\view\admintwo\node_modules\pngquant-bin
> node lib/install.js
getaddrinfo ENOENT raw.githubusercontent.com
pngquant pre-build test failed
compiling from source
Error: pngquant failed to build, make sure that libpng-dev is installed
at F:\wechat-applet-v3\view\admintwo\node_modules\bin-build\node_modules\execa\index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 0)
> pngquant-bin@5.0.2 postinstall F:\wechat-applet-v3\view\admintwo\node_modules\pngquant\node_modules\pngquant-bin
> node lib/install.js
‼ getaddrinfo ENOENT raw.githubusercontent.com
‼ pngquant pre-build test failed
i compiling from source
× Error: pngquant failed to build, make sure that libpng-dev is installed
at F:\wechat-applet-v3\view\admintwo\node_modules\bin-build\node_modules\execa\index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 0)
npm WARN eslint-config-standard@12.0.0 requires a peer of eslint@>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-standard@12.0.0 requires a peer of eslint-plugin-node@>=7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-standard@12.0.0 requires a peer of eslint-plugin-promise@>=4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-standard@12.0.0 requires a peer of eslint-plugin-standard@>=4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@11.1.1 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN uglifyjs-webpack-plugin@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server@2.9.1 requires a peer of webpack@^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\vue-puzzle-vcode\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: gifsicle@5.2.1 (node_modules\gifsicle):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: gifsicle@5.2.1 postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mozjpeg@7.1.1 (node_modules\mozjpeg):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: mozjpeg@7.1.1 postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: optipng-bin@7.0.1 (node_modules\optipng-bin):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: optipng-bin@7.0.1 postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pngquant-bin@6.0.1 (node_modules\pngquant-bin):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pngquant-bin@6.0.1 postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pngquant-bin@5.0.2 (node_modules\pngquant\node_modules\pngquant-bin):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: pngquant-bin@5.0.2 postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
added 24 packages from 7 contributors in 200.504s
52 packages are looking for funding
run `npm fund` for details
根据以往的经验哪里报错搜哪里,搜索错误Error: pngquant failed to build, make sure that libpng-dev is installed 网上找到个资料是安装对应的pngquant模块:安装命令:npm install --save-dev pngquant 是安装成功了,但是错误仍未解决.而还有一个错误是:Error: Command failed: C:\Windows\system32\cmd.exe /s /c "./configure --with-system-zlib这个错误在网上直接搜索找不到相关的信息.最后看到错误详情里面有个错误警告信息出现的次数较多,搜索一下,找到了解决办法.
getaddrinfo ENOENT raw.githubusercontent.com
gifsicle pre-build test failed
根据这个警告搜索到的解决办法,在host文件添加该网址的IP地址即可解决. 在host添加以下内容.
#npm包
# npm ChaJianBao addresses
185.199.108.133 raw.githubusercontent.
199.232.28.133 raw.githubusercontent.com
执行成功的截图:
对了,本人在实际运行过程中还发现,npm命令执行的非常缓慢,你可以考虑切换npm镜像源,或者让你的电脑可以直接访问github,也可以提高你的npm命令效率哦.
希望对您有帮助,本人自己运行了一个爱企小站(www.aiqisite.com),会在上面分享自己的开发经验,欢迎关注.