2016-11-18 82 views
1

所以我試圖彌合客觀c和node.js中使用 'nodobjc':電子:模塊版本不匹配。預計50,48了

var $ = require('NodObjC') 
$.framework('Foundation') 
var pool = $.NSAutoreleasePool('alloc')('init') 
var string = $.NSString('stringWithUTF8String', 'Hello Objective-C World!') 
console.log(string) 
pool('drain') 

添加此之後,我得到這個異常:

模塊版本不匹配。預計50,得到48.

我使用節點v7.1.0 & NPM 3.10.9。 我檢查了this看是否有什麼東西過時,但沒有任何與NODE_MODULE_VERSION 50。 這是怎麼回事?

+0

您是否嘗試過針對當前節點版本重建本地模塊? –

+1

@JensHabegger:我解決了這個問題:npm rebuild --runtime = electron --target = 1.3.1 --disturl = https://atom.io/download/atom-shell --build-from-source Rebuilt它使用不同的目標版本,它的工作! –

回答

4

我前幾天面臨着類似的問題,以下是我固定它:

npm install electron-rebuild --save-dev 

然後調用(Windows)中

.\node_modules\.bin\electron-rebuild.cmd 

或(在Linux,Mac)

.\node_modules\.bin\electron-rebuild 

基本上你需要重建電子每次你添加新的本地模塊到應用程序。

+2

Szydlo:謝謝!我解決了這個問題: 'npm rebuild --runtime = electron --target = 1.3.1 --disturl = https://atom.io/download/atom-shell --build-from-source' 重建它使用不同的目標版本,它的工作! –

0

我解決了它的乳寧這樣的:

npm rebuild --runtime=electron --target=1.3.1 --disturl=atom.io/download/atom-shell --build-from-source

使用不同的目標版本重建它和它的工作!