背景
日常升级博客前端,居然失败了。。。。。开始在问答区提问了,康师傅建议升级node。我刚开始也是想的,但是又不想升级,最后,还是升级。。。哈哈。懒。
我的环境
我的博客之前是走Jenkins拉代码自动编译部署的,我现在手动看看错误。 当我执行了我的构建脚本,有了下面的错误。
//就是构建镜像嘛
docker build -t sob-blog-nuxt .
日志:
ERROR: npm is known not to run on Node.js v10.15.3
You'll need to upgrade to a newer Node.js version in order to use this
version of npm. You can find the latest version at https://nodejs.org/
The command '/bin/sh -c cnpm cache clean --force' returned a non-zero code: 1
康师傅回答是升级,我尝试升级了下。
升级node
我的环境centos。那就下载对应系统的node。 到这里下载Linux的。https://nodejs.org/en/download/
我下载了一个16版本的。上传到服务器。
进行解压。
xz -d node16.xxx.tar.xz
tar -xvf node16.xxx.tar
//得到文件夹之后,复制到之前环境哪里替换下。
//之前我的node放在/usr/local中
//现在替换下就行了,删除之前node,复制过来。
node -v
v16.16.0
继续构建镜像。
也许只有构建镜像的时候CPU才会动起来吧,平时的使用率不到5%。。。。
感谢康师傅的回答~~