1、ubuntu 安装npm
sudo apt install nodejs npm
2、设置包下载源
npm config set registry https://registry.npmmirror.com/
3.安装包及运行
npm install
安装成功后会生成一个node_moudels目录
运行:
npm run serve
4、常见报错及解决方式
(1)old lockfile报错
npm WARN old lockfile
npm WARN deprecated [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm ERR! Cannot read property 'insert' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2024-10-23T14_29_13_268Z-debug-0.log
解决:
rm -rf node_modules package-lock.json
npm install
(2)下载源可能报错无认证:
npm ERR! code CERT_HAS_EXPIRED
npm ERR! errno CERT_HAS_EXPIRED
npm ERR! request to https://registry.npm.taobao.org/yorkie/download/yorkie-2.0.0.tgz failed, reason: certificate has expired
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2024-10-23T14_25_10_918Z-debug-0.log
j解决:禁用ssl:
npm config set strict-ssl false
标签:node,npm,vue,log,ERR,axios,报错,安装
From: https://www.cnblogs.com/iruan/p/18499821