我正在尝试在 Windows 上建立一个 Gatsby 入门项目。具体来说,这个入门项目:https://www.gatsbyjs.com/starters/hasura/gatsby-gitbook-starter/
\n节点:v14.10.1\nnpm:6.14.8\nGatsby CLI 版本:2.12.99\nGatsby 版本:2.18.10
\n我打开一个新终端并根据文档运行 Gatsby Starter 脚本:
\n"gatsby new gatsby-gitbook-starter https://github.com/hasura/gatsby-gitbook-starter"\nRun Code Online (Sandbox Code Playgroud)\n成功克隆初始启动程序后,系统指示我 cd 进入该目录并运行“gatsby-develop”。
\n这会引发以下错误:
\nsuccess open and validate gatsby-configs - 0.081s\n\n ERROR \n\n\nSomething went wrong installing the "sharp" module\n\nCannot find module \'../build/Release/sharp.node\'\nRequire stack:\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\sharp\\lib\\constructor.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\sharp\\lib\\index.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby-plugin-sharp\\safe-sharp.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby-plugin-sharp\\index.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby-plugin-sharp\\gatsby-node.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby\\dist\\bootstrap\\resolve-module-exports.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby\\dist\\bootstrap\\load-plugins\\validate.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby\\dist\\bootstrap\\load-plugins\\load.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby\\dist\\bootstrap\\load-plugins\\index.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby\\dist\\bootstrap\\index.js\n- C:\\code\\Sutro\\gatsby-gitbook-starter2\\node_modules\\gatsby\\dist\\commands\\develop.js\n- C:\\Users\\mxgel\\AppData\\Roaming\\npm\\node_modules\\gatsby-cli\\lib\\create-cli.js\n- C:\\Users\\mxgel\\AppData\\Roaming\\npm\\node_modules\\gatsby-cli\\lib\\index.js\n- C:\\Users\\mxgel\\AppData\\Roaming\\npm\\node_modules\\gatsby-cli\\cli.js\n\n- Remove the "node_modules/sharp" directory, run "npm install" and look for errors\n- Consult the …Run Code Online (Sandbox Code Playgroud) \n\ngatsby 公开开发成功并验证 gatsby-configs - 0.005 s\n 错误安装“sharp”模块出现问题模块\n \'\\?\\D:\\korero\\node_modules\\sharp\\build\ \Release\\sharp.node\' 是使用 NODE_MODULE_VERSION\n 针对不同的 Node.js 版本编译的\n 64。此版本的 Node.js 需要 NODE_MODULE_VERSION 79。请尝试重新编译或重新安装该模块(例如、使用
\nnpm\n rebuild或npm install)。\n - 确保安装时使用的 Node.js 版本与运行时使用的版本相匹配\n - 请参阅安装文档:https://sharp.pixelplumbing.com/en/stable/install/ \n - 在https://github.com/lovell/sharp/issues \xe2\xa0\x8b 加载插件中搜索此错误
运行时sudo npm i sharp --save出现以下错误:
> sharp@0.21.3 install /home/server/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
info sharp Using cached /home/ronny/.npm/_libvips/libvips-8.7.0-linux-x64.tar.gz
ERR! sharp EACCES: permission denied, mkdir '/home/server/node_modules/sharp/vendor'
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/page/install for required dependencies
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/server/node_modules/sharp/build'
gyp ERR! System Linux …Run Code Online (Sandbox Code Playgroud)