2017-03-18 2 views
0

Electron内でAngular CLIプロジェクトを実行しています。私は自分のコンポーネントの1つに@pokusew/pcscliteをインポートしてNFC機能を使用しようとしています。私は​​を使ってライブラリをインポートします。私はthis.pcsc = pcsclite()を呼び出したらしかし、私は、コンソールで次のエラーを取得する:Angular2/Electronスローで@ pokusew/pcscliteをインポートするTypeError

TypeError: exists is not a function

、ビルドプロセス中:

WARNING in ./~/bindings.js

Critical dependency: the request of a dependency is an expression

+0

エラーと最小コードのスクリーンショットを含む投稿を更新してください。また、質問する前に[** this **](http://stackoverflow.com/help/how-to-ask)を見てください – Aravind

答えて

0

TypeError: exists is not a functionは、ノード・バインディングモジュールのバグのように見えます。参照してください:https://github.com/TooTallNate/node-bindings/pull/20

新しいリリースがNPMで利用可能な場合は修正する必要があります。

ただし、AngularCLI/Webpackを使用している場合、この修正により、まだ@pokusew/pcscliteは動作しません。この設定で動作させるには@pokusew/pcscliteは、node-bindingsの代わりにnode-loaderを使用してバインディングファイルをロードする必要があります。その後

"dependencies": { 
    "bindings": "github:tootallnate/node-bindings#pull/20/head", < Instead of this, 
    "node-loader": "^0.6.0", << use this 
    "nan": "^2.5.1" 
}, 

編集「/node_modules/@pokusew/pcsclite/lib/pcsclite.jsを:

編集 "/node_modules/@pokusew/pcsclite/package.json":あなたはこのように、ローカルにそれを変更することができます

const pcsclite = require('node-loader!./../build/Release/pcsclite.node');

関連する問題