我已经为这个问题寻找了半年多的解决方案,我已经尝试了我在 Internet 上找到的所有内容,但没有任何效果。我正在使用 Window 10。
最后,别无选择,我通过以下方式解决了这个问题:
Remove VSCode from your computer COMPLETELY and then reinstall it.
如果你想保留你的设置,请去你的VSCode的设置,输入settings.json,或者只是.json,或者你复制内容并保留它,或者你在左边的EXPLORER中右键单击它到“在文件资源管理器中显示”,然后复制并保留它。如果您有自己的“键绑定”,请复制并保留同一文件夹中的文件。
要完全删除 VSCode,请按照以下步骤操作:
1. In VSCode, delete "node_modules" and "package-lock.json" first, and then,
2. Go to "Console Panel", go to "Programs", click "Uninstall a program",
and then uninstall "Visual Studio Code".
3. Open Run (Win + R, i.e. press the Windows Key and the R key),
4. Enter "%appdata%",
5. Press Enter,
6. Delete folder "Code".
7. In the address field on the top of your computer, go to the folder
with your name as the folder name, and delete folder ".vscode".
替代步骤 3-7,使用文件夹路径:
=> C: drive
=> folder "Users"
=> folder with your name (your own folder)
=> delete folder ".vscode"
=> folder "AppData" (sometimes it's hidden)
=> folder "Roaming"
=> delete folder "Code".
之后,你可以重新安装VSCode,运行命令“npm install”,就可以了。
请注意,我以这种方式解决了我的问题。虽然我不能保证你的问题能以同样的方式解决,但你可以尝试一下,因为它从头开始。
也不必担心你会遇到多少麻烦。其实很简单,几乎没有问题。