nvm,node,npm,yarn相关安装报错问题记录

问题一:

yarn : 无法加载文件 D:\jsPackage\nodejs\node_global\yarn.ps1,因为在此系统上禁止运行脚本。

解决:

步骤1,powerShell以管理员运行后,输入命令:

get-ExecutionPolicy 查看权限, 会看到它的返回值是 Restricted , 意思是 当前是禁用的。

步骤2, 在窗口上执行:

set-ExecutionPolicy RemoteSigned,然后输入Y,按Enter确认.

步骤3, 查看执行策略:get-ExecutionPolicy,看到它的返回值是 RemoteSigned

问题二:

npm ERR! ERESOLVE could not resolve。npm install 装包报错重新装包;

解决:依赖重装

npm i --legacy-peer-deps

问题三:

npm install报错 -> npm ERR! Unexpected token '.' 报错解决办法。

解决:

由于低版本nvm不能适用控制高版本node,需要先卸载各node版本,再卸载nvm,再安装最新版本nvm。

问题四:

msvs_version was set from command line or npm config

Please restart this script from an administrative PowerShell!
npm ERR! The build tools cannot be installed without administrative rights.

解决: 用管理员身份打开 PowerShell 运行命令

问题五:

verbose audit error HttpErrorGeneral: 404 Not Found - POST https://registry.npmmirror.com/-/npm/v1/security/audits/quick

解决:

意思是说镜像获取不到,输入命令 npm config get registry,查看当前npm镜像源,是taobao的,

切换回默认的试试看。npm config delete registry

问题六:

gyp ERR! configure error

gyp ERR! stack Error: Command failed: C:\Python\Python3.7.3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];

node.js与系统的python版本冲突 我的是Py3.7

解决:npm config set python python2.7

问题七:

yarn

error commander@9.2.0: The engine "node" is incompatible with this module. Expected version "^12.20.0 || >=14". Got "12.13.0" error Found incompatible module.

解决:

Yarn创建Vue项目,出现node版本不兼容问题。 执行: yarn config set ignore-engines true

问题八:

yarn add 报

error Missing list of packages to add to your project. info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

解决:

yarn add --save lodash 安装就会报这个错

改成这样:yarn add lodash --save

因为yarn add后面必须跟包名。

问题九:

These dependencies were not found:

* core-js/modules/es.array.push.js in ./node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js, ./src/main.js and 58 others

解决:

用于绕过peerDependency里依赖的自动安装,依赖对等.

npm i --legacy-peer-deps

相关推荐
码农水水7 分钟前
阿里Java面试被问:Online DDL的INSTANT、INPLACE、COPY算法差异
java·服务器·前端·数据库·mysql·算法·面试
Coder_Boy_8 分钟前
基于SpringAI的在线考试系统-知识点管理与试题管理模块联合回归测试文档
前端·人工智能·spring boot·架构·领域驱动
吃吃喝喝小朋友12 分钟前
JavaScript事件
开发语言·前端·javascript
EEEzhenliang17 分钟前
CSS的注释
前端·css
猪猪侠|ZZXia22 分钟前
# Shell+web+hook的系统构建发布运维系统之API及前端: zzxia-lollipop-remote-gan
运维·前端
Coder_Boy_25 分钟前
基于SpringAI的在线考试系统-教学管理与用户管理模块联合回归测试文档
java·前端·数据库·人工智能·spring boot
希赛网28 分钟前
网工面试:常问技术问题汇总(3)
服务器·前端·网络·网络工程师·ospf·网工面试·技术面
WYiQIU29 分钟前
普及一下字节前端岗需要达到的强度......
前端·javascript·vue.js·面试·职场和发展
切糕师学AI36 分钟前
Win11 如何彻底阻止 Edge 后台运行
前端·edge
小阿鑫42 分钟前
32岁程序员猝死背后,我的一些真实感受
前端·后端·程序员·代码人生