相关疑难解决方法(0)

尽管安装了 npm,Gatsby 还是找不到 fs

我上线了:

  • Ubuntu 16.04
  • 盖茨比 CLI 版本:2.7.14
  • 盖茨比版本:2.13.21
  • 节点 v10.16.0
  • 新公共管理 6.10.1

我正在关注 Gatsby 教程“7. 以编程方式从数据创建页面”。我无法解决此错误:

This dependency was not found:
?
* fs in ./node_modules/electron/index.js,
?
To install it, you can run: npm install --save fs
Run Code Online (Sandbox Code Playgroud)

我已经跑npm install --save fs了,然后又试了一次。但是会出现同样的错误。目录的权限设置为a+rwx,到目前为止一切都安装得很好。

当我将此代码添加到 gatsby-node.js 时会发生此错误,如教程所述:

const { createFilePath } = require(`gatsby-source-filesystem`)

exports.onCreateNode = ({ node, getNode }) => {
  if (node.internal.type === `MarkdownRemark`) {
    console.log(createFilePath({ node, getNode, basePath: `pages` }))
  }
}
Run Code Online (Sandbox Code Playgroud)

我运行时的完整事件流程gatsby develop -p …

fs node.js npm gatsby

6
推荐指数
1
解决办法
2323
查看次数

标签 统计

fs ×1

gatsby ×1

node.js ×1

npm ×1