dimensional-de / napi-canon-cameras

Node AddOn Api module for Canon cameras
GNU General Public License v3.0
59 stars 22 forks source link

creating package gives an error #2

Closed sitan closed 3 years ago

sitan commented 3 years ago

Hi Thomas, nice project!!

I was trying to do: npm run package and I ran into an error, see below:

Any suggestions?

Thanks in advance, Sitan van Sluis

Using: Windows 10, Visual Studio Community 2019 EDSDKv131300W npm version { '@dimensional/napi-canon-cameras': '0.1.0', npm: '7.6.2', node: '14.16.0', v8: '8.4.371.19-node.18', uv: '1.40.0', zlib: '1.2.11', brotli: '1.0.9', ares: '1.16.1', modules: '83', nghttp2: '1.41.0', napi: '7', llhttp: '2.1.3', openssl: '1.1.1j', cldr: '37.0', icu: '67.1', tz: '2020a', unicode: '13.0' }


@dimensional/napi-canon-cameras@0.1.0 _update:stubs node ./helpers/update-stubs.js

internal/modules/cjs/loader.js:1122 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: Een initialisatieroutine van de dynamic link library (DLL-bestand) is mislukt. \?\C:\Users\info\napi-canon-cameras-master\prebuilds\win32-x64\node.napi.node at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at load (C:\Users\info\napi-canon-cameras-master\node_modules\node-gyp-build\index.js:21:10) at Object. (C:\Users\info\napi-canon-cameras-master\camera-api.js:1:40) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) npm ERR! code 3221225477 npm ERR! path C:\Users\info\napi-canon-cameras-master npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./helpers/update-stubs.js

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\info\AppData\Local\npm-cache_logs\2021-04-22T14_18_28_264Z-debug.log npm ERR! code 3221225477 npm ERR! path C:\Users\info\napi-canon-cameras-master npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run _update:stubs && npm run _build:stubs:types && npm run _build:es2015 && npm run _build:esm && npm run _build:umd && npm run _build:umd:min

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\info\AppData\Local\npm-cache_logs\2021-04-22T14_18_28_291Z-debug.log npm ERR! code 3221225477 npm ERR! path C:\Users\info\napi-canon-cameras-master npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run prebuild:ia32 && npm run prebuild:x64 && npm run build:stubs

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\info\AppData\Local\npm-cache_logs\2021-04-22T14_18_28_312Z-debug.log npm ERR! code 3221225477 npm ERR! path C:\Users\info\napi-canon-cameras-master npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm run prebuild && node helpers/create-tgz.js

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\info\AppData\Local\npm-cache_logs\2021-04-22T14_18_28_333Z-debug.log /c/Program Files/nodejs/npm: line 37: 1861 Segmentation fault "$NODE_EXE" "$NPM_CLI_JS" "$@"

ThomasWeinert commented 3 years ago

I tried to reproduce it with node 14.16.0, but it works for me. However it fails with node 15.14.0. I will try to investigate, but I have no idea yet. :-(

sitan commented 3 years ago

Hi Thomas, thanks for getting back on this. You say it fails with 15.14.0. Does it fail the same way as I described or differentely?

ThomasWeinert commented 3 years ago

The error looks comparable, but I am not sure that it is the same. I tried disabling the classes initializations (inside the module initialization) but the error persists.

ThomasWeinert commented 3 years ago

I refactored some of the ID property lists and now it works on node 14 - 16, if compiled on node 14. Could you check if that fixed your error please?

The error is:

Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\...\napi-canon-cameras\prebuilds\win32-x64\node.napi.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Function.Module._load (node:internal/modules/cjs/loader:828:14)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at load (C:\...\napi-canon-cameras\node_modules\node-gyp-build\index.js:21:10)
    at Object.<anonymous> (C:\...\napi-canon-cameras\camera-api.js:1:40)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)

Process finished with exit code -1073741819 (0xC0000005)
sitan commented 3 years ago

I will give it a try, thanks!! Sitan

sitan commented 3 years ago

Hi Thomas, I've reinstalled nodejs, synced with your git version, deleted node_modules, deleted package-lock.json and did npm run package...however: error is still the same. Same as the error you've posted above.


Attempt 2. Creating library c:\Users\info\napi-canon-cameras-master\build\Release\canon_api.lib and object c:\Users\info\napi -canon-cameras-master\build\Release\canon_api.exp Generating code Previous IPDB not found, fall back to full compilation. All 4953 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. Finished generating code canon_api.vcxproj -> c:\Users\info\napi-canon-cameras-master\build\Release\canon_api.node gyp info ok

@dimensional/napi-canon-cameras@0.1.0 build:stubs npm run _update:stubs && npm run _build:stubs:types && npm run _build:es2015 && npm run _build:esm && npm run _build:umd && npm run _build:umd:min

@dimensional/napi-canon-cameras@0.1.0 _update:stubs node ./helpers/update-stubs.js

internal/modules/cjs/loader.js:1127 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: Een initialisatieroutine van de dynamic link library (DLL-bestand) is mislukt. \?\c:\Users\info\napi-canon-cameras-master\prebuilds\win32-x64\node.napi.node at Object.Module._extensions..node (internal/modules/cjs/loader.js:1127:18) at Module.load (internal/modules/cjs/loader.js:933:32) at Function.Module._load (internal/modules/cjs/loader.js:774:14) at Module.require (internal/modules/cjs/loader.js:957:19) at require (internal/modules/cjs/helpers.js:88:18) at load (c:\Users\info\napi-canon-cameras-master\node_modules\node-gyp-build\index.js:21:10) at Object. (c:\Users\info\napi-canon-cameras-master\camera-api.js:1:40) at Module._compile (internal/modules/cjs/loader.js:1068:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10) at Module.load (internal/modules/cjs/loader.js:933:32)


Attempt 3.

Then I tried on a different computer, it seems to work on that (except from a mkdir command that failed on Windows). I'll try it again.

sitan commented 3 years ago

Hi Thomas, I've created the directories /node_packages/@dimensional by hand, and the build process has finished succesfully! Thank you for your work! I'll try to use the examples later this week.

sitan commented 3 years ago

Hi Thomas, I did some testing with the created package and it works fine. I've created a tsconfig.json and a package.json, installed tsc and transpiled app.ts with tsc app.ts to app.js and run it with node app.js (I'm a newbie on nodejs...).

Small note: in your ## Build package tutorial you wrote: 5. npm -i ../node_packages/@dimensional/napi-canon-cameras.tgz I think it should be npm i (without -).

I got the cameralist, camera properties, took a picture and generated csv files and started the interval with the liveview. Nicely done! Thanks!

ThomasWeinert commented 3 years ago

I am happy to hear that. šŸ„³

Sorry about the directory. I have a global directory "NodeRepository" that I link into project group directories as "node_packages". Seems I forgot the recursive option for the mkdir call. :-)

You are right about the install command. Fixed it and updated the example code to match the refactorings.

Thank you for your persistence.

kwongki commented 2 years ago

Hi,

I came across your project with great interest as I'm trying to also control my Canon camera via a nodeJS app. I was able to run all the prebuilds without issue, but it failed with the same error specifically at npm run _update:stubs.

Seems like the problem is the node.api.node file is not initialising properly or I'm building the .node file wrongly?

Really appreciate any ideas to resolve this.

I'm using: Windows 10, Visual Studio Build tools 2019 EDSDK13.14.30 npm version

  '@dimensional/napi-canon-cameras': '0.1.0',
  npm: '8.5.5',
  node: '16.15.0',
  v8: '9.4.146.24-node.20',
  uv: '1.43.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '93',
  nghttp2: '1.47.0',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1n+quic',
  cldr: '40.0',
  icu: '70.1',
  tz: '2021a3',
  unicode: '14.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

This is the error I got:

> @dimensional/napi-canon-cameras@0.1.0 _update:stubs
> node ./helpers/update-stubs.js

node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\work2\napi-canon-cameras\prebuilds\win32-x64\node.napi.node
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at load (C:\work2\napi-canon-cameras\node_modules\node-gyp-build\index.js:25:10)
    at Object.<anonymous> (C:\work2\napi-canon-cameras\camera-api.js:2:40)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  code: 'ERR_DLOPEN_FAILED'
}

And I'm using the "EDSDK_13.14.40" branch

ThomasWeinert commented 2 years ago

Some of the successful builds can not be loaded. It seems to depend on the node version and the EDSDK version. You can experiment with the different branches for specific EDSDK releases. For me I need to build with node 14.16 and can load the result in node 14 to 16.

Here is no compiling error so I have no idea how to fix this at the moment.

kwongki commented 2 years ago

Thank you! Yes. building with node 14.16 works!

Olliebrown commented 2 years ago

Greetings! I am running into this issue today. Using node 14.16.0 and trying to package but I get that same error:

> @dimensional/napi-canon-cameras@0.1.0 _update:stubs D:\Programming-School\napi-canon-cameras
> node ./helpers/update-stubs.js

internal/modules/cjs/loader.js:1122
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: A dynamic link library (DLL) initialization routine failed.
\\?\D:\Programming-School\napi-canon-cameras\prebuilds\win32-x64\node.napi.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at load (D:\Programming-School\napi-canon-cameras\node_modules\node-gyp-build\index.js:21:10)
    at Object.<anonymous> (D:\Programming-School\napi-canon-cameras\camera-api.js:1:40)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)

I am using that EDSDK_13.14.40 branch. Here's my version info if that helps:

{
  '@dimensional/napi-canon-cameras': '0.1.0',
  npm: '6.14.11',
  ares: '1.16.1',
  brotli: '1.0.9',
  cldr: '37.0',
  icu: '67.1',
  llhttp: '2.1.3',
  modules: '83',
  napi: '7',
  nghttp2: '1.41.0',
  node: '14.16.0',
  openssl: '1.1.1j',
  tz: '2020a',
  unicode: '13.0',
  uv: '1.40.0',
  v8: '8.4.371.19-node.18',
  zlib: '1.2.11'
}

I'm at a loss for anything else to try! I did previously have node v16 installed but I attempted to remove that and switch to 'nvm for windows' should I could install the older version of node.