我想重新安装expo-cli,但出现错误。无法卸载expo-cli。

3

我尝试使用Expo构建应用程序,但失败了,然后我尝试重新安装Expo-cli。 因此,我输入了下面的代码以删除Expo-cli。

npm -g uninstall expo-cli --save

并且
(base) Bongui-MacBookPro:expo-firebase-master bong$ npm uninstall expo-cli -g
up to date in 0.042s

但是,如果我输入"expo",它将会运行。

所以,如果你再次忽略这个问题并尝试重新安装expo-cli, 将会出现以下错误:

npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/expo-cli/bin/expo.js
npm ERR! dest /Users/bong/npm-global/bin/expo-cli
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/expo-cli/bin/expo.js' -> '/Users/bong/npm-global/bin/expo-cli'
npm ERR! File exists: /Users/bong/npm-global/bin/expo-cli
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bong/.npm/_logs/2020-01-28T09_18_38_604Z-debug.log

谢谢老师。 请帮我解决这个问题。 谢谢。

2个回答

5
我想你在构建时可能想要覆盖当前文件夹。 尝试在命令中使用--force扩展名,这将解决问题。我推测类似于:npm install -g --force expo-cli。 希望这能有所帮助。

1

我正在使用Linux,Ubuntu尝试了一下。

sudo npm install -g --force expo-cli

它对我起作用了。


这对我也管用。Expo为什么如此糟糕?总是有依赖项的问题...起初我使用他们推荐的npx方法,但似乎更糟糕... - Brian Birtle

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接