无法将"gatsby-plugin-netlify-cms"插件安装到盖茨比博客



我无法将Gatsby plugin for Netlify CMS安装到我的博客中。我一直在学习将NetlifyCMS添加到现有博客的教程,并参考了这篇文档。

复制步骤

以下是我的回购链接:https://github.com/mohammedasker/blogger

  1. 克隆我的repo并转到项目目录
  2. 运行npm install --save netlify-cms-app gatsby-plugin-netlify-cms

预期结果

Gatsby plugin for Netlify CMS安装成功。

实际结果

为Netlify CMS安装Gatsby插件时出错。

这是我从终端得到的错误日志:

npm ERR! code EPERM
npm ERR! syscall unlink
npm ERR! path C:UsersUserDesktopMohd Projectsbloggernode_modules@emotionweak-memoizedist
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, unlink 'C:UsersUserDesktopMohd Projectsbloggernode_modules@emotionweak-memoizedist'
npm ERR!  [OperationalError: EPERM: operation not permitted, unlink 'C:UsersUserDesktopMohd Projectsbloggernode_modules@emotionweak-memoizedist'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, unlink 'C:UsersUserDesktopMohd Projectsbloggernode_modules@emotionweak-memoizedist'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'unlink',
npm ERR!     path: 'C:\Users\User\Desktop\Mohd Projects\blogger\node_modules\@emotion\weak-memoize\dist'
npm ERR!   },
npm ERR!   stack: "Error: EPERM: operation not permitted, unlink 'C:\Users\User\Desktop\Mohd Projects\blogger\node_modules\@emotion\weak-memoize\dist'",
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path: 'C:\Users\User\Desktop\Mohd Projects\blogger\node_modules\@emotion\weak-memoize\dist',
npm ERR!   parent: 'blogger'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

环境

System:
OS: Windows 10 10.0.18363
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Binaries:
Node: 12.13.0 - C:Program Filesnodejsnode.EXE
Yarn: 1.21.1 - ~scoopappsyarncurrentYarnbinyarn.CMD
npm: 6.12.0 - C:Program Filesnodejsnpm.CMD
Browsers:
Edge: 44.18362.449.0
npmPackages:
gatsby: ^2.23.18 => 2.24.11
gatsby-image: ^2.4.12 => 2.4.13
gatsby-plugin-emotion: ^4.3.9 => 4.3.10
gatsby-plugin-manifest: ^2.4.17 => 2.4.21
gatsby-plugin-netlify: ^2.3.10 => 2.3.11
gatsby-plugin-offline: ^3.2.16 => 3.2.21
gatsby-plugin-react-helmet: ^3.3.9 => 3.3.10
gatsby-plugin-sharp: ^2.6.17 => 2.6.22
gatsby-remark-prismjs: ^3.5.9 => 3.5.10
gatsby-remark-reading-time: ^1.1.0 => 1.1.0
gatsby-source-filesystem: ^2.3.18 => 2.3.23
gatsby-transformer-remark: ^2.8.23 => 2.8.27
gatsby-transformer-sharp: ^2.5.10 => 2.5.11
npmGlobalPackages:
gatsby-cli: 2.12.60

我尝试过的东西

我尝试在其他Gatsby项目中安装该插件,并以root/Administrator身份再次运行该命令(命令提示符(。不幸的是,它们都没有奏效。

如错误所示:

操作系统拒绝了该操作。这是可能的文件已经在使用(由文本编辑器或防病毒软件(,

在不运行gatsby develop的情况下重试相同的操作。

出现错误的原因是,当运行gatsby develop时,您正在读取node_modules文件夹,因为许多功能都在使用它(如导入、实时重载等(。当程序读取这些文件时,系统无法覆盖或安装/添加来自其他来源的新文件夹(在本例中为npm(,因为您的操作系统正在使用这些文件夹。

在运行gatsby develop之前安装Gatsby plugin for Netlify CMS插件已经解决了这个问题。

最新更新