我上线了:
我正在关注 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 …