node不管你喜不喜欢、有没有了解过,但在项目中却总是会用到,开源的集成太多了.不管是哪一个框架,composer安装后,总会给你集成一大堆的东西,不管你有没有了解过,后期开发会不会用到,全给你集成进去了(因为框架会用到)。
laravel也是带这样的坑,laravel使用了mix,必须要用到node,没啥关系的两种开发环境,就这样硬集成一块去了。node环境出问题,影响了laravel无法正常安装使用,你明明用的是laravel,但却要去解决node的问题。坑不坑?其实挺坑的!
回到正题,还是laravel-shop的安装问题,换了一台机,又得重新再安装一遍,前台页面还是报Mix错误,查了node跟npm的版本,比较低,npm install -g npm升级又升级不了!执行npm命令(任何一个),就报以下这个错:
估计是版本问题,执行以下方法升级node了。
再重新在网站根目录删除node_modules后,再执行npm install,却一直报下面的错误
npm WARN tarball tarball data for [email protected] (sha1-DBxPBwC+2NvBJM2zBNJZLKID5nc=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for [email protected] (sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for [email protected] (sha1-k8WjrP2+8nUiCtcmRK0C7hg2jeE=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for [email protected] (sha1-ut+hSX1GJE9jkPWLMZgw2RB4U8U=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for [email protected] (sha1-ut+hSX1GJE9jkPWLMZgw2RB4U8U=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for [email protected] (sha1-ut+hSX1GJE9jkPWLMZgw2RB4U8U=) seems to be corrupted. Trying one more time.
npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to http://registry.npm.taobao.org/schema-utils/download/schema-utils-0.4.7.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npm.taobao.org:80
npm WARN tar ENOENT: no such file or directory, open '/var/www/html/laravel-shop/node_modules/.staging/postcss-97c9ec6c/lib/comment.js'
npm WARN tar ENOENT: no such file or directory, open '/var/www/html/laravel-shop/node_modules/.staging/postcss-97c9ec6c/lib/previous-map.js'
npm WARN tar ENOENT: no such file or directory, open '/var/www/html/laravel-shop/node_modules/.staging/postcss-97c9ec6c/lib/processor.js'
npm WARN tar ENOENT: no such file or directory, open '/var/www/html/laravel-shop/node_modules/.staging/postcss-69fa6fb1/lib/map-generator.js'
npm WARN tarball tarball data for [email protected] (sha1-ut+hSX1GJE9jkPWLMZgw2RB4U8U=) seems to be corrupted. Trying one more time.
npm WARN tarball tarball data for [email protected] (sha1-ut+hSX1GJE9jkPWLMZgw2RB4U8U=) seems to be corrupted. Trying one more time.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/zhou/.npm/_logs/2020-01-06T07_47_33_935Z-debug.log
是终解决方案:
#使用其它的镜像,之前用了淘宝的,切换dns为233.5.5.5都不行,再换为其它的吧!
npm config set registry http://r.cnpmjs.org
#完成后,重新执行install
npm cache verify && npm install
#最后重新启动一下npm
npm run production
最后感谢一下以下作者