0

我正在尝试在具有可选依赖项的项目中执行 npm 脚本,keytar. 即使安装了,npm 错误说没有安装。这是错误。

Error: Optional dependency keytar was not installed
    at Object._getKeytar (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/keychain.js:61:11)
    at Object.keychain [as default] (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/keychain.js:70:26)
    at Object._getKeychain (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:70:59)
    at /home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:81:39
    at step (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:33:23)
    at Object.next (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:14:53)
    at /home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:4:12)
    at Object._getService (/home/ubuntu/test-install/node_modules/flex-dev-utils/dist/credentials.js:76:40)

为了确认依赖项是否存在,我尝试了npm list keytar

plugin-qcsp-twilio@0.0.0 /home/ubuntu/test-install
└─┬ flex-plugin-scripts@4.0.1
  └─┬ flex-dev-utils@4.0.1
    └── keytar@7.7.0

仅当我在 linux 环境中而不是在 Windows 中运行此问题时才会出现此问题。

以下是我的依赖列表package.json

    "dependencies": {
        "axios": "^0.21.1",
        "bootstrap": "^4.0.0",
        "jquery": "^3.6.0",
        "moment": "^2.29.1",
        "popper.js": "^1.16.1",
        "react": "16.5.2",
        "react-dom": "16.5.2"
    },
    "devDependencies": {
        "@twilio/flex-ui": "^1",
        "flex-plugin-scripts": "4.0.1",
        "fs-extra": "^10.0.0",
        "glob": "^7.1.7",
        "node-sass": "^4.14.0",
        "react-test-renderer": "16.5.2",
        "replace-in-file": "^6.2.0"
    }

任何关于我如何解决这个问题的线索将不胜感激。

4

0 回答 0