Open netmiller opened 6 years ago
@netmiller I use graphene with electron. This is error from https://github.com/PeculiarVentures/pkcs11js/blob/master/src/pkcs11/pkcs11.cpp#L131 It cannot find pkcs#11 lib by path
Do you use .npmrc
for electron project?
runtime = electron
target = 1.7.6
target_arch = x64
disturl = https://atom.io/download/atom-shell
No, I have not. I will try that next, thanks. 👍
You need create .npmrc
file in the root of your electron project and call npm rebuild
No luck, same errors.
► iMac@electron4$ cat .npmrc
runtime = electron
target = 1.7.9
target_arch = x64
disturl = https://atom.io/download/atom-shell
I have Electron 1.7.9 installed.
graphene-module: function Module(lib) {
var _this = _super.call(this, lib) || this;
_this.libFile = "";
_this.libName = "";
return _this;
}
lib: ./lib/libykcs11.dylib
App threw an error during load
Error: dlopen(./lib/libykcs11.dylib, 1): Library not loaded: @loader_path/libcrypto.1.0.0.dylib
Referenced from: /Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib
Reason: image not found
at Error (native) Load:131
at Function.Module.load (/Users/esa/devel/yubikey/electron4/node_modules/graphene-pk11/build/module.js:47:13)
at Object.<anonymous> (/Users/esa/devel/yubikey/electron4/lib/getToken.js:19:20)
at Object.<anonymous> (/Users/esa/devel/yubikey/electron4/lib/getToken.js:80:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
I tried npm rebuild
and also uninstall and install graphene. Also tried electron-rebuild
I suppose you have no Yubikey, but is this purely Electron specific error or related Yubikey library?
I use path
for relative libs
const path = require("path");
const lib = path.join(__dirname, "..", "lib", "libykcs11.dylib");
const mod = Module.load(lib, "libName");
P.S. I'll try to create simple electron app to test it (~10 minutes)
@microshine OK, thanks. I have to take break now, but I will try again this evening (takes 5~6 hours local time). Have to go shopping :) But I will try path etc. before that.
Do you use graphene from main.js or from HTML window?
It's in main process. Nothing in renderer; I like to use ipc for communicating with UI.
This is quite strange: path.join
is doing well, and lib-path is ok .
> electron .
++lib: /Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib
App threw an error during load
Error: dlopen(/Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib, 1): Library not loaded: @loader_path/libcrypto.1.0.0.dylib
Referenced from: /Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib
Reason: image not found
at Error (native) Load:131
at Function.Module.load (/Users/esa/devel/yubikey/electron4/node_modules/graphene-pk11/build/module.js:47:13)
at Object.<anonymous> (/Users/esa/devel/yubikey/electron4/lib/getToken.js:22:21)
at Object.<anonymous> (/Users/esa/devel/yubikey/electron4/lib/getToken.js:85:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
and lib in in its right place :
► iMac@electron4$ file /Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib
/Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib: Mach-O 64-bit dynamically linked shared library x86_6
Here's my current code:
const graphene = require('graphene-pk11');
const Module = graphene.Module;
const lib = path.join(__dirname, "./libykcs11.dylib");
console.log('\n++lib:', lib);
const mod = Module.load(lib, "libName");
Can it have some effects because my module (calling graphene) is also in lib subdir, and I will call it from main.js with require : const get_token = require('./lib/getToken');
► iMac@electron4$ ll lib
Permissions Size User Date Modified Git Name
.rw-r--r-- 1.1k esa 16 Dec 12:18 -N getSSH.js
.rwxr-xr-x@ 106k esa 16 Dec 12:25 -N libykcs11.dylib
.rw-r--r--@ 2.6k esa 16 Dec 14:53 -N getToken.js
and main.js is in project root (also .npmrc)
► iMac@electron4$ pwd
/Users/esa/devel/yubikey/electron4
► iMac@electron4$ ll
Permissions Size User Date Modified Git Name
.rw-r--r-- 1.2k esa 16 Dec 10:16 -N semantic.json
drwxr-xr-x - esa 16 Dec 10:17 -N semantic
drwxr-xr-x - esa 16 Dec 12:25 -N lib
.rw-r--r-- 3.4k esa 16 Dec 12:33 -M index.html
.rw-r--r-- 1.2k esa 16 Dec 13:17 -M renderer.js
.rw-r--r-- 98 esa 16 Dec 14:28 -N .npmrc
.rw-r--r-- 3.7k esa 16 Dec 14:29 -M main.js
drwxr-xr-x - esa 16 Dec 14:29 -- node_modules
.rw-r--r-- 264k esa 16 Dec 14:29 -N package-lock.json
.rw-r--r-- 600 esa 16 Dec 14:29 -M package.json
drwxr-xr-x - esa 16 Dec 15:03 -- .git
const electron = require("electron");
const graphene = require("graphene-pk11");
const { BrowserWindow } = electron;
const mod = graphene.Module.load("/usr/local/lib/softhsm/libsofthsm2.so", "SoftHSM");
mod.initialize();
const slots = mod.getSlots(true);
console.log(slots);
mod.finalize();
electron.app.on("ready", () => {
let win = new BrowserWindow({ width: 800, height: 600 })
win.on('closed', () => {
win = null
})
// Load a remote URL
win.loadURL('https://github.com');
// Or load a local HTML file
win.loadURL(`file://${__dirname}/index.html`)
})
runtime = electron
target = 1.7.6
target_arch = x64
disturl = https://atom.io/download/atom-shell
I added script to browser Window. It works too
@microshine OK, many thanks. I will try this evening with SoftHSM, and try again with yubikey-lib. No have to take break. Manu thanks, I'm sure this is going to solve.
There can be another problem with Yubico. I've got it on Windows. Their pkcs11 lib depends of libeay32 and piv libs. I fixed it by coping those libs to electron executable file
try to use otool -L <binary>
command to check it
maybe you need to have other yubico libs near the pkcs11 lib
OK, but same code is working well with bare Node-env. And I have no extra libs but libykcs11.dylib. And I'm developing in Mac (as you can see). But anyway with running node-command it's working without problem.
Here is otool output :
► iMac@electron4$ otool -L ./lib/libykcs11.dylib
./lib/libykcs11.dylib:
@loader_path/libykcs11.1.dylib (compatibility version 5.0.0, current version 5.6.0)
@loader_path/libykpiv.1.dylib (compatibility version 5.0.0, current version 5.6.0)
@loader_path/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
I tried it with my Yubikey NEO
Must be something to do cause i use require submodule (and require graphene etc is there) and it will return callback to main.js . You have graphene straight in your main.js. I will try your way.
@microshine Some progress; now it is working well when I use absolute path from /usr/local/lib/libykcs11.dylib".
And when using my local version from subdir ./lib it throws errors !
Code that works 👍
const lib = "/usr/local/lib/libykcs11.dylib";
// const lib = '/Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib';
const mod = graphene.Module.load(lib);
mod.initialize();
...etc...
Even when using abs.path to my local lib, it throws errors.
Obviously something to do with libs?? Have you idea what is missing and what extra libs should I have locally. Funny thing is that this same code is workin with bare Node, but not with Electron.
I can develop my project using /usr/local/lib.....
, but my target is to wrap final app with some installer and I guess I have same problems when installing it to target workstations. Target in mainly for Win10 env, but I need to make simple stand-alone app without extra installations. So this is good to resolve before deadline.
I will try to package my testapp with some of many Electron's packagers, so we will see what happens. Have you any favourite? (for Win/win10 env)
Here is otool output from these two libs (which I thought being same level, but now I'm not sure where I have copied this local lib-version ??
► iMac@electron4$ otool -L /usr/local/lib/libykcs11.dylib
/usr/local/lib/libykcs11.dylib:
/usr/local/opt/yubico-piv-tool/lib/libykcs11.1.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/local/Cellar/yubico-piv-tool/1.5.0/lib/libykpiv.1.dylib (compatibility version 6.0.0, current version 6.0.0)
/usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)
► iMac@electron4$ otool -L ./lib/libykcs11.dylib
./lib/libykcs11.dylib:
@loader_path/libykcs11.1.dylib (compatibility version 5.0.0, current version 5.6.0)
@loader_path/libykpiv.1.dylib (compatibility version 5.0.0, current version 5.6.0)
@loader_path/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
Thanks anyway, now the problem is focused so I can continue developing, and try to solve this dynlib problem. I'm not very familiar wirh dynamic libs; so any help is wellcome .
Have you tried to add dep lib to the same folder where pkcs11 lib is?
Do you mean __./node_modules/pkcs11js__ or something else. No I have not. Here is node_modules, do you mean that and what subdir should I try.
► iMac@electron4$ pwd
/Users/esa/devel/yubikey/electron4
► iMac@electron4$ ll node_modules/pkcs11js/
Permissions Size User Date Modified Git Name
.rw-r--r-- 56 esa 14 Oct 12:52 -- index.js
.rw-r--r-- 1.9k esa 14 Oct 12:52 -- binding.gyp
.rw-r--r-- 1.1k esa 14 Oct 12:52 -- LICENSE
.rw-r--r-- 12k esa 14 Oct 15:14 -- README.md
.rw-r--r-- 47k esa 12 Dec 14:23 -- index.d.ts
drwxr-xr-x - esa 16 Dec 14:29 -- includes
drwxr-xr-x - esa 16 Dec 14:29 -- src
.rw-r--r-- 2.2k esa 16 Dec 14:29 -- package.json
drwxr-xr-x - esa 16 Dec 15:46 -- build
Should I have libcrypto.1.0.0.dylib somewhere? I don't know what lib it is:
App threw an error during load
Error: dlopen(/Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib, 1):
Library not loaded: @loader_path/libcrypto.1.0.0.dylib
Referenced from: /Users/esa/devel/yubikey/electron4/lib/libykcs11.dylib
Seems to be some openssl lib. Now I copied libcrypto.1.0.0.dylib to my local electron-lib (./lib in my project root).
And it works now without linking to /usr/local/lib.
Closer... closer ... I have to continue next week, and I will try to make installer/executable, and let's see how it behaves.
@microshine Thank you.
@microshine I an playing now with Win10, and can't get graphene installed.
PS C:\Users\esa\devel\electron\test4> yarn add graphene-pk11
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
error graphene-pk11@2.0.31: The engine "node" is incompatible with this module. Expect
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Then tried to add option ignore-engines and hoping I can rebuild it after, but throws :
PS C:\Users\esa\devel\electron\test4> yarn add graphene-pk11 --ignore-engines
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] ⠈ pkcs11js: Muodostetaan projekteja t�ss� ratkaisussa yksi kerrallaan. Jos haluat ottaa k�ytt��n rinnakka
[-/1] ⠈ waiting...
[-/1] ⠁ waiting...
[-/1] ⠁ waiting...
error C:\Users\esa\devel\electron\test4\node_modules\pkcs11js: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: C:\Users\esa\devel\electron\test4\node_modules\pkcs11js
Output:
C:\Users\esa\devel\electron\test4\node_modules\pkcs11js>if not defined npm_config_node_gyp (node "C:\Program Files\nodej
s\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.9.3 | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\esa\\devel\\electron\\test4\\node_modules\\pkcs11js\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\esa\\.node-gyp\\8.9.3\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\esa\\.node-gyp\\8.9.3',
gyp info spawn args '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\esa\\.node-gyp\\8.9.3\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\esa\\devel\\electron\\test4\\node_modules\\pkcs11js',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\esa\\devel\\electron\\test4\\node_modules\\pkcs11js\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Muodostetaan projekteja t�ss� ratkaisussa yksi kerrallaan. Jos haluat ottaa k�ytt��n rinnakkaisen muodostuksen, lis�� /m
-valitsin.
MSBUILD : error MSB4132: Ty�kalujen versiota 2.0 ei tunnistettu. Kelvolliset ty�kalujen versiot ovat "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:2
58:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\esa\devel\electron\test4\node_modules\pkcs11js
Some err.messages are localized, because my Win10 is local language.
But have you any idea what is missing? .NET\Framework ??? or something else?
My Win10 is quite normal without extra installations; except I have to install python because otherwise it can't install at all ?? Btw. tried also npm but it throws :
PS C:\Users\esa\devel\electron\test4> npm i --save graphene-pk11
> pkcs11js@1.0.12 install C:\Users\esa\devel\electron\test4\node_modules\pkcs11js
> node-gyp rebuild
C:\Users\esa\devel\electron\test4\node_modules\pkcs11js>if not defined npm_config_node_gyp (node "C:\Program Files\nodej
s\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Muodostetaan projekteja tässä ratkaisussa yksi kerrallaan. Jos haluat ottaa käyttöön rinnakkaisen muodostuksen, lisää /m
-valitsin.
MSBUILD : error MSB4132: Työkalujen versiota 2.0 ei tunnistettu. Kelvolliset työkalujen versiot ovat "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:2
58:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\esa\devel\electron\test4\node_modules\pkcs11js
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN test4@1.0.0 No description
npm WARN test4@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pkcs11js@1.0.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js@1.0.12 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\esa\AppData\Roaming\npm-cache\_logs\2017-12-18T12_59_28_830Z-debug.log
Debug log is too long.... but I can put it somewhere if needed.
Any workaround for this?
Graphene uses only one native plugin - pkcs11js
. Could you try to build pkcs11js
manually? It can show more info about problem
git clone https://github.com/PeculiarVentures/pkcs11js.git
cd pkcs11js
npm install
node-gyp configure
node-gyp build
You can send your log file to microshine@mail.ru
OK, tried but throws errors while npm install
PS C:\Users\esa\devel\electron> git clone https://github.com/PeculiarVentures/pkcs11js.git
Cloning into 'pkcs11js'...
remote: Counting objects: 782, done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 782 (delta 4), reused 5 (delta 3), pack-reused 765
Receiving objects: 100% (782/782), 192.77 KiB | 237.00 KiB/s, done.
Resolving deltas: 100% (475/475), done.
PS C:\Users\esa\devel\electron> cd .\pkcs11js\
PS C:\Users\esa\devel\electron\pkcs11js> npm install
> pkcs11js@1.0.12 install C:\Users\esa\devel\electron\pkcs11js
> node-gyp rebuild
C:\Users\esa\devel\electron\pkcs11js>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\
bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Muodostetaan projekteja tässä ratkaisussa yksi kerrallaan. Jos haluat ottaa käyttöön rinnakkaisen muodostuksen, lisää /m
-valitsin.
MSBUILD : error MSB4132: Työkalujen versiota 2.0 ei tunnistettu. Kelvolliset työkalujen versiot ovat "4.0".
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:2
58:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node
-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\esa\devel\electron\pkcs11js
gyp ERR! node -v v8.9.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pkcs11js@1.0.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pkcs11js@1.0.12 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\esa\AppData\Roaming\npm-cache\_logs\2017-12-18T14_54_37_750Z-debug.log
and you can find debug.log from gist: https://gist.github.com/netmiller/8771e3a75b3bb0b91b3fb2fd62f762e1
Maybe nothing differs, but I'm running my Win10 under Parallels VM in my iMac.
@netmiller Did it help with MSB4132
error?
Working on it... first it throws "must run with administrative PowerShell", and now finally found "Administrative" version, it's trying just now.... lets see.
Seems to take a long time .....
PS C:\Users\esa\devel\electron\pkcs11js>
PS C:\Users\esa\devel\electron\pkcs11js> npm install --global --production windows-build-tools
> windows-build-tools@1.3.2 postinstall C:\Users\esa\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./lib/index.js
Downloading BuildTools_Full.exe
Downloading python-2.7.13.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.13.msi. Saved to C:\Users\esa\.windows-build-tools\python-2.7.13.msi.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Waiting for installers... |Successfully installed Python 2.7
Waiting for installers... /
I checked it on my Windows 10. It works
OK, pkcs11js will now install :
PS C:\Users\esa\devel\electron\pkcs11js> npm install --global --production windows-build-tools
> windows-build-tools@1.3.2 postinstall
C:\Users\esa\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./lib/index.js
Downloading BuildTools_Full.exe
Downloading python-2.7.13.msi
[> ] 0.0% (0 B/s)
Downloaded python-2.7.13.msi. Saved to C:\Users\esa\.windows-build-tools\python-2.7.13.msi.
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!
Waiting for installers... |Successfully installed Python 2.7
Waiting for installers... |Successfully installed Visual Studio Build Tools.
+ windows-build-tools@1.3.2
added 125 packages in 658.422s
PS C:\Users\esa\devel\electron\pkcs11js> npm config set msvs_version 2015 --global
PS C:\Users\esa\devel\electron\pkcs11js> npm install
> pkcs11js@1.0.12 install C:\Users\esa\devel\electron\pkcs11js
> node-gyp rebuild
C:\Users\esa\devel\electron\pkcs11js>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
main.cpp
dl.cpp
const.cpp
error.cpp
v8_convert.cpp
template.cpp
mech.cpp
param.cpp
param_aes.cpp
param_rsa.cpp
param_ecdh.cpp
pkcs11.cpp
async.cpp
node.cpp
win_delay_load_hook.cc
Creating library C:\Users\esa\devel\electron\pkcs11js\build\Release\pkcs11.lib and object C:\Users\esa\devel\elect
ron\pkcs11js\build\Release\pkcs11.exp
Generating code
Finished generating code
pkcs11.vcxproj -> C:\Users\esa\devel\electron\pkcs11js\build\Release\\pkcs11.node
pkcs11.vcxproj -> C:\Users\esa\devel\electron\pkcs11js\build\Release\pkcs11.pdb (Full PDB)
> pkcs11js@1.0.12 prepare C:\Users\esa\devel\electron\pkcs11js
> npm run build
> pkcs11js@1.0.12 build C:\Users\esa\devel\electron\pkcs11js
> node-gyp configure build
C:\Users\esa\devel\electron\pkcs11js>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure build ) else (node "" configure build )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
pkcs11.vcxproj -> C:\Users\esa\devel\electron\pkcs11js\build\Release\\pkcs11.node
pkcs11.vcxproj -> C:\Users\esa\devel\electron\pkcs11js\build\Release\pkcs11.pdb (Full PDB)
up to date in 19.094s
PS C:\Users\esa\devel\electron\pkcs11js>
I will try graphene under adminPowerShell.
And graphene also install now :
PS C:\Users\esa\devel\electron\test4> npm i graphene-pk11 -S
> pkcs11js@1.0.12 install C:\Users\esa\devel\electron\test4\node_modules\pkcs11js
> node-gyp rebuild
C:\Users\esa\devel\electron\test4\node_modules\pkcs11js>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
main.cpp
dl.cpp
const.cpp
error.cpp
v8_convert.cpp
template.cpp
mech.cpp
param.cpp
param_aes.cpp
param_rsa.cpp
param_ecdh.cpp
pkcs11.cpp
async.cpp
node.cpp
win_delay_load_hook.cc
Creating library C:\Users\esa\devel\electron\test4\node_modules\pkcs11js\build\Release\pkcs11.lib and object C:\Us
ers\esa\devel\electron\test4\node_modules\pkcs11js\build\Release\pkcs11.exp
Generating code
Finished generating code
pkcs11.vcxproj -> C:\Users\esa\devel\electron\test4\node_modules\pkcs11js\build\Release\\pkcs11.node
pkcs11.vcxproj -> C:\Users\esa\devel\electron\test4\node_modules\pkcs11js\build\Release\pkcs11.pdb (Full PDB)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN test4@1.0.0 No description
npm WARN test4@1.0.0 No repository field.
+ graphene-pk11@2.0.31
added 3 packages in 13.546s
PS C:\Users\esa\devel\electron\test4>
Thanks a lot, I will try forward with electron+graphene (under Win10).
Maybe it all is this "AdministrativePowerShell" problem?? I did not remember that.
At least my graphene-test-progs are working well under node
.
Tomorrow I will try electron and electron installer :) This was quite tricky env but hope it starts working better after that. Thanks @microshine .
I have some errors with library loader/path when using my Yubikey 4 with Electron (main process).
and here is the code :
I have tried variations of relative path, and also absolute path (as you can see).
Same code works fine with bare Node env, but Electron changes the game :(
I guess this is related how Electron handle native-node-modules, but does anyone have any workaround to try??
I have to use electron-rebuild after installing graphene module, otherwise it throws error about different Node-versions, and electron-rebuild works for that.
I found also some documentation : https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md
but didn't tried yet.
Is there anyone who has same kind of errors, or any workaround for that. Otherwise I am happy with graphene, it works very well with Yubikey PIV.
Btw. I'm running my testapp in dev-mode, and have not tried to use any packager or installers yet. Just run . electron.