如何在电子应用中使用领域?

时间:2017-06-11 15:27:03

标签: node.js realm electron

ERROR in ./~/realm/lib/browser/index.js

Module not found: Error: Can't resolve 'react-native' in
'/Users/H/Documents/MyApp/node_modules/realm/lib/browser'

@ ./~/realm/lib/browser/index.js 21:0-45

@ ./~/realm/lib/index.js

@ ./render/routes/tools/Network.js

@ ./render/router.js

@ ./render/index.js

@ multi (webpack)-dev-server/client?http://localhost:9527 webpack/hot/dev-server react-hot-loader/patch webpack-dev-server/client?http://localhost:9527/ webpack/hot/only-dev-server ./render/index.js

Not rewriting GET /dist/bundle.js because the path includes a dot (.) character.

我想在realm应用中使用electron,我使用下面的代码,但它不起作用且错误信息在上面。

const Realm = require('realm')
let realm = new Realm({
  schema: [
    {
      name: 'LogItem',
      properties: {
        time: 'date',
        percent: 'double'
      }
    }
  ]
})
realm.write(() => {
  realm.create('Log', {
    time: new Date(),
    percent: 90.00
  })
})

1 个答案:

答案 0 :(得分:0)

Realm正在开发Electron支持,但目前不支持它(这就是为什么你会收到错误)。您可以在此处跟踪他们的工作:https://github.com/realm/realm-js/issues/818