如何解决安装 npm install --global expo-cli 时出错
我在安装 expo-cli 时遇到问题,我该如何解决这个错误?请参考下图。 更新 我刚刚从我的记事本原始 JSON 解释对象中发布了错误日志:可以在 See C:\Users\User\AppData\Local\npm-cache\eresolve-report 中找到此运行的完整日志.txt 获取完整报告。
{
"code": "ERESOLVE","current": {
"name": "type-fest","version": "0.5.2","location": "node_modules/expo-cli/node_modules/type-fest","dependents": [
{
"type": "prod","name": "type-fest","spec": "^0.5.2","from": {
"name": "boxen","version": "4.1.0","location": "node_modules/expo-cli/node_modules/boxen","dependents": [
{
"type": "prod","name": "boxen","spec": "4.1.0","from": {
"name": "expo-cli","version": "4.4.1","location": "node_modules/expo-cli","dependents": [
{
"type": "prod","name": "expo-cli","spec": "*","from": {
"location": "C:\\Users\\User\\AppData\\Roaming\\npm"
}
}
]
}
},{
"type": "prod","from": {
"name": "xdl","version": "59.0.32","location": "node_modules/expo-cli/node_modules/xdl","name": "xdl","spec": "59.0.32","from": {
"name": "expo-cli","dependents": [
{
"type": "prod","from": {
"location": "C:\\Users\\User\\AppData\\Roaming\\npm"
}
}
]
}
},{
"type": "peer","from": {
"name": "@expo/dev-tools","version": "0.13.92","location": "node_modules/expo-cli/node_modules/@expo/dev-tools","name": "@expo/dev-tools","spec": "0.13.92","from": {
"name": "expo-cli","dependents": [
{
"type": "prod","from": {
"location": "C:\\Users\\User\\AppData\\Roaming\\npm"
}
}
]
}
}
]
}
}
]
}
}
]
}
}
]
},"edge": {
"type": "peerOptional","spec": "^0.13.1","error": "INVALID","from": {
"name": "@pmmmwh/react-refresh-webpack-plugin","version": "0.3.3","location": "node_modules/expo-cli/node_modules/@pmmmwh/react-refresh-webpack-plugin","dependents": [
{
"type": "prod","name": "@pmmmwh/react-refresh-webpack-plugin","spec": "^0.3.3","from": {
"name": "@expo/webpack-config","version": "0.12.66","location": "node_modules/expo-cli/node_modules/@expo/webpack-config","dependents": [
{
"type": "prod","name": "@expo/webpack-config","spec": "0.12.66","from": {
"name": "xdl","dependents": [
{
"type": "prod","from": {
"name": "expo-cli","dependents": [
{
"type": "prod","from": {
"location": "C:\\Users\\User\\AppData\\Roaming\\npm"
}
}
]
}
},{
"type": "peer","from": {
"name": "@expo/dev-tools","from": {
"name": "expo-cli","dependents": [
{
"type": "prod","from": {
"location": "C:\\Users\\User\\AppData\\Roaming\\npm"
}
}
]
}
}
]
}
}
]
}
}
]
}
}
]
}
},"peerConflict": null,"strictPeerDeps": false,"force": false
}
解决方法
试试这个
npm cache clear --force
然后
npm install --global expo-cli
如果这不起作用,那么试试这个, 这个解决方案不是最好的,也不是最安全的解决方案,但这会起作用,这是有道理的,因为这里所有的错误问题都是权限问题。所以你可以使用这个命令并忽略那些权限问题:
sudo npm install expo-cli -g --unsafe-perm
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。