fileUtils.writeStringToFile写入文件api无法使用

import { _decorator, assetManager, Component, error, Node, path, Sprite, native, Vec3 } from ‘cc’;

const { fileUtils } = native;

const nodeInfo = this.getNodeInfo(this.node);

    const content = JSON.stringify(nodeInfo, null, 4);

    const assetsPath = Editor.Project.path + '/assets';

    const filePath = path.join(assetsPath, 'node-info2.json'); 

    fileUtils.writeStringToFile(filePath, content);

在windown本地开发环境运行的:然后一直报错:Cannot read property ‘writeStringToFile’ of undefined。
官方文档:
import { native } from “cc”;
const { fileUtils } = native; 也是这样导入的

有没有大佬遇到过这个问题 :joy: :rofl: :rofl:

你这是写游戏项目代码还是编辑器插件代码啊?

如果是编辑器插件,直接用 node 的文件接口即可。