错误无法找到 node_modules/cordova-plugin-whitelist

1 angularjs ionic-framework ionic2 ionic3 ionic4

我正在尝试构建一个 ionic 项目,当我尝试使用该命令时,
ionic capacitor run android
我收到一条错误消息,
[error] Unable to find node_modules/cordova-plugin-whitelist. Are you sure cordova-plugin-whitelist is installed? [ERROR] An error occurred while running subprocess capacitor.
我已检查是否安装了cordova-plugin-whitelist,它是
Plugin "cordova-plugin-whitelist" already installed on android. Adding cordova-plugin-whitelist to package.json
如何解决这个问题的?

Ven*_*ryx 5

npx cap sync在为cordova插件安装npm包后,我在运行时出现了这个“无法找到node_modules/X”的问题。(上下文:尝试在我的 Capacitor 项目中使用 Cordova 插件)

我通过以下方式解决了它:

  1. 关闭我的代码编辑器(导致第 2 步出现问题)。
  2. 运行npm install。
  3. 又跑npx cap sync了。

npx cap sync然后该命令成功完成。