node.js - Node 持久化 : initSync is not a function

标签 node.js persist

我刚刚开始学习Nodejs。
我正在学习持久模块。这是我的代码:

var storage = require('node-persist');
// console.log(storage);
storage.initSync();

但是我遇到了这个错误

TypeError: storage.initSync is not a function

而console.log存储时,只有create和init

{ create: [Function], init: [Function] }

我的代码有什么地方错误吗?

最佳答案

您应该检查 3.0.0 更改日志

All the *Sync functions were removed, every operation is now asynchronous

https://www.npmjs.com/package/node-persist#300-change-logs

关于node.js - Node 持久化 : initSync is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53929277/

相关文章:

hibernate - 如果 Cascade.persist 和 Cascade.remove 在 Hibernet 的父实体中一起使用,则级联删除不起作用

java - 使用JPA持久化时是否需要设置实体类的所有字段?

javascript - Knex 迁移播种完成但出现外键错误

javascript - Gulp 中基本 JavaScript 字符串相等失败

Java/hibernate : How can I insert a specific value for a column with autoincrement/@GeneratedValue

C# Web API 服务数据不持久

core-data - 你如何将 NSMutableArray 中的数据存储在 Core Data 中?

node.js - MongoDB updateOne 为 upsertedId 返回 null

node.js - 将 MongoDB View 合并到 Node 中

node.js - Node 不会运行,只是退出代码 0