安装企业插件
Page summary:企业插件通过 Strapi 软件包注册表分发给包含这些插件的许可证。
strapi enterprise install命令会找到你的许可证,设置注册表访问权限,并安装与你的 Strapi 应用兼容的版本。
企业插件不会发布在公共的 npm 注册表上。它们的安装方式和其他依赖一样,而 Strapi 的包注册表只提供你 Strapi 许可证包含的插件。strapi enterprise install 命令会为你设置好注册表,所以不需要手动编辑包管理器的配置文件。
🌐 Enterprise plugins are not published on the public npm registry. They are installed like any other dependency, and the Strapi package registry only serves the plugins your Strapi license includes. The strapi enterprise install command sets up the registry for you, so package manager configuration files don't need to be edited by hand.
- 一个 Strapi 5.59.0 或更高版本的应用,并且已经安装了它的依赖。
- CMS企业版计划的许可证。许可证密钥可以在Strapi账单门户中获得。
- npm、pnpm 或 Yarn(1 或 2 及以后版本)。
安装插件
🌐 Installing a plugin
要安装企业插件,请在你的 Strapi 应用根文件夹下运行 strapi enterprise install 命令:
🌐 To install Enterprise plugins, run the strapi enterprise install command from the root folder of your Strapi application:
- 不用任何参数,这个命令会列出你的许可证包含的企业插件,这样你就可以选择要安装或升级哪些插件。
- 当把一个或多个插件名称作为参数传入时,命令会直接安装它们。
@strapi-enterprise/前缀是可选的。
- Yarn
- NPM
- pnpm
列出可安装或升级的插件:
yarn strapi enterprise install
按名称安装插件:
🌐 Installing plugins by name:
yarn strapi enterprise install plugin-byok
列出可安装或升级的插件:
npm run strapi enterprise install
按名称安装插件:
🌐 Installing plugins by name:
npm run strapi enterprise install plugin-byok
列出可安装或升级的插件:
pnpm strapi enterprise install
按名称安装插件:
🌐 Installing plugins by name:
pnpm strapi enterprise install plugin-byok
手动设置访问权限
🌐 Setting up access manually
这个命令是可选的。如果你想自己设置访问权限,可以将这些行添加到你的用户级配置文件中,并用你的许可证替换 <your license>:
🌐 The command is optional. To set up access yourself, add these lines to your user-level configuration file, with your license in place of <your license>:
- npm, pnpm, Yarn 1 (~/.npmrc)
- Yarn 2 and later (~/.yarnrc.yml)
@strapi-enterprise:registry=https://packages.strapi.io/
//packages.strapi.io/:_authToken=<your license>
npmScopes:
strapi-enterprise:
npmRegistryServer: 'https://packages.strapi.io/'
npmAlwaysAuth: true
npmAuthToken: '<your license>'
如果文件已经有一个 npmScopes 键,就在它下面添加 strapi-enterprise 条目。
🌐 If the file already has an npmScopes key, add the strapi-enterprise entry under it.
现在文件包含了你的许可,所以用 chmod 600 ~/.npmrc 限制它只给你的用户。然后用你的包管理器安装插件,同时保存确切的版本:npm install --save-exact @strapi-enterprise/<plugin-name>。
🌐 The file now holds your license, so restrict it to your user with chmod 600 ~/.npmrc. Then install the plugin with your package manager, saving the exact version: npm install --save-exact @strapi-enterprise/<plugin-name>.
故障排除
🌐 Troubleshooting
| 信息 | 怎么做 |
|---|---|
No Strapi license found… | 设置 STRAPI_LICENSE,或者在终端中运行命令来粘贴许可证。 |
This Strapi license is not valid… | 再次从账单门户复制整个许可证。 |
This Strapi license expired on… | 更新你的许可证。 |
…rejected this Strapi license… | 在账单门户中检查许可证是否仍然有效。 |
Your license does not include… | 检查插件名称。如果名称正确,请联系你的客户经理。 |
No Enterprise package named… | 检查插件名称。 |
… has no version or tag … | 检查你添加到插件名称的版本。 |
… requires Strapi … and this app uses … | 先升级 Strapi。 |
Could not reach https://packages.strapi.io… | 检查你的网络连接、代理和防火墙。 |
Could not tell which package manager this app uses… | 先安装你应用的依赖,或者在 package.json 中设置 packageManager。 |
… already sets up packages.strapi.io with another license… | 用消息里的那些行替换这些行。 |
… sets another license for packages.strapi.io and takes precedence… | 更新或删除指定文件中的那一行。 |
… could not be updated automatically… | 将消息中的行添加到指定文件,然后再次运行该命令。 |
Could not search packages.strapi.io… | 稍后再试,或者提供插件名称。 |
Pass package names, or run the command in an interactive terminal. | 在终端运行命令,或者像在 CI 中一样传入插件名称。 |
| 安装依赖失败并出现 401 或 404 错误 | 请参见 手动设置访问权限。 |