Skip to content

Installation failes #3

@ps73

Description

@ps73
npm install node-twain
npm ERR! code 1
npm ERR! path /Users/username/Documents/projects/node-scanner/node_modules/node-twain
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/twain/src/main.o
npm ERR!   CXX(target) Release/obj.target/twain/src/TwainSession.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.12.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.9 found at "/opt/homebrew/opt/python@3.10/bin/python3.10"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.10/bin/python3.10
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/username/.nvm/versions/node/v18.12.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/username/Documents/projects/node-scanner/node_modules/node-twain/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/username/.nvm/versions/node/v18.12.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/username/Library/Caches/node-gyp/18.12.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/username/Library/Caches/node-gyp/18.12.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/username/.nvm/versions/node/v18.12.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/username/Library/Caches/node-gyp/18.12.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/username/Documents/projects/node-scanner/node_modules/node-twain',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/main.cpp:2:
npm ERR! In file included from ../src/TwainSDK.h:11:
npm ERR! In file included from ../src/TwainSession.h:12:
npm ERR! ../src/twain/Common.h:201:11: warning: 'MAX' macro redefined [-Wmacro-redefined]
npm ERR!   #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
npm ERR!           ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/param.h:218:9: note: previous definition is here
npm ERR! #define MAX(a, b) (((a)>(b))?(a):(b))
npm ERR!         ^
npm ERR! In file included from ../src/main.cpp:2:
npm ERR! In file included from ../src/TwainSDK.h:11:
npm ERR! In file included from ../src/TwainSession.h:12:
npm ERR! ../src/twain/Common.h:202:11: warning: 'MIN' macro redefined [-Wmacro-redefined]
npm ERR!   #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
npm ERR!           ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/param.h:215:9: note: previous definition is here
npm ERR! #define MIN(a, b) (((a)<(b))?(a):(b))
npm ERR!         ^
npm ERR! In file included from ../src/main.cpp:2:
npm ERR! In file included from ../src/TwainSDK.h:11:
npm ERR! In file included from ../src/TwainSession.h:12:
npm ERR! ../src/twain/Common.h:207:13: warning: 'kTWAIN_DSM_DIR' macro redefined [-Wmacro-redefined]
npm ERR!     #define kTWAIN_DSM_DIR       "/Library/Frameworks/TWAINDSM.framework/Versions/Current/"
npm ERR!             ^
npm ERR! ../src/twain/Common.h:108:13: note: previous definition is here
npm ERR!     #define kTWAIN_DSM_DIR         "/usr/local/lib/"
npm ERR!             ^
npm ERR! ../src/twain/Common.h:208:13: warning: 'kTWAIN_DSM_DLL_NAME' macro redefined [-Wmacro-redefined]
npm ERR!     #define kTWAIN_DSM_DLL_NAME  "TWAINDSM"
npm ERR!             ^
npm ERR! ../src/twain/Common.h:194:11: note: previous definition is here
npm ERR!   #define kTWAIN_DSM_DLL_NAME "libtwaindsm.so"
npm ERR!           ^
npm ERR! In file included from ../src/main.cpp:2:
npm ERR! In file included from ../src/TwainSDK.h:11:
npm ERR! ../src/TwainSession.h:104:33: warning: missing field 'DSM_Entry' initializer [-Wmissing-field-initializers]
npm ERR!     TW_ENTRYPOINT gDSMEntry = {0};
npm ERR!                                 ^
npm ERR! 5 warnings generated.
npm ERR! In file included from ../src/TwainSession.cpp:5:
npm ERR! In file included from ../src/TwainSession.h:12:
npm ERR! ../src/twain/Common.h:201:11: warning: 'MAX' macro redefined [-Wmacro-redefined]
npm ERR!   #define MAX(a, b)  (((a) > (b)) ? (a) : (b))
npm ERR!           ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/param.h:218:9: note: previous definition is here
npm ERR! #define MAX(a, b) (((a)>(b))?(a):(b))
npm ERR!         ^
npm ERR! In file included from ../src/TwainSession.cpp:5:
npm ERR! In file included from ../src/TwainSession.h:12:
npm ERR! ../src/twain/Common.h:202:11: warning: 'MIN' macro redefined [-Wmacro-redefined]
npm ERR!   #define MIN(a, b)  (((a) < (b)) ? (a) : (b))
npm ERR!           ^
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/param.h:215:9: note: previous definition is here
npm ERR! #define MIN(a, b) (((a)<(b))?(a):(b))
npm ERR!         ^
npm ERR! In file included from ../src/TwainSession.cpp:5:
npm ERR! In file included from ../src/TwainSession.h:12:
npm ERR! ../src/twain/Common.h:207:13: warning: 'kTWAIN_DSM_DIR' macro redefined [-Wmacro-redefined]
npm ERR!     #define kTWAIN_DSM_DIR       "/Library/Frameworks/TWAINDSM.framework/Versions/Current/"
npm ERR!             ^
npm ERR! ../src/twain/Common.h:108:13: note: previous definition is here
npm ERR!     #define kTWAIN_DSM_DIR         "/usr/local/lib/"
npm ERR!             ^
npm ERR! ../src/twain/Common.h:208:13: warning: 'kTWAIN_DSM_DLL_NAME' macro redefined [-Wmacro-redefined]
npm ERR!     #define kTWAIN_DSM_DLL_NAME  "TWAINDSM"
npm ERR!             ^
npm ERR! ../src/twain/Common.h:194:11: note: previous definition is here
npm ERR!   #define kTWAIN_DSM_DLL_NAME "libtwaindsm.so"
npm ERR!           ^
npm ERR! In file included from ../src/TwainSession.cpp:5:
npm ERR! ../src/TwainSession.h:104:33: warning: missing field 'DSM_Entry' initializer [-Wmissing-field-initializers]
npm ERR!     TW_ENTRYPOINT gDSMEntry = {0};
npm ERR!                                 ^
npm ERR! ../src/TwainSession.cpp:61:14: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
npm ERR!     if(error = dlerror() != NULL) {
npm ERR!        ~~~~~~^~~~~~~~~~~~~~~~~~~
npm ERR! ../src/TwainSession.cpp:61:14: note: place parentheses around the assignment to silence this warning
npm ERR!     if(error = dlerror() != NULL) {
npm ERR!              ^
npm ERR!        (                        )
npm ERR! ../src/TwainSession.cpp:61:14: note: use '==' to turn this assignment into an equality comparison
npm ERR!     if(error = dlerror() != NULL) {
npm ERR!              ^
npm ERR!              ==
npm ERR! ../src/TwainSession.cpp:360:30: warning: missing field 'RefCon' initializer [-Wmissing-field-initializers]
npm ERR!     TW_CALLBACK callback = {0};
npm ERR!                              ^
npm ERR! ../src/TwainSession.cpp:524:5: error: no matching function for call to 'strcpy'
npm ERR!     strcpy(fileXfer.FileName, (fileName + ext).c_str());
npm ERR!     ^~~~~~
npm ERR! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/string.h:79:7: note: candidate function not viable: no known conversion from 'TW_STR255' (aka 'unsigned char[256]') to 'char *' for 1st argument
npm ERR! char    *strcpy(char *__dst, const char *__src);
npm ERR!          ^
npm ERR! ../src/TwainSession.cpp:602:14: warning: unused variable 'bScanStarted' [-Wunused-variable]
npm ERR!         bool bScanStarted = false;
npm ERR!              ^
npm ERR! ../src/TwainSession.cpp:603:13: warning: unused variable 'nBytePerRow' [-Wunused-variable]
npm ERR!         int nBytePerRow = (((imageInfo.ImageWidth * imageInfo.BitsPerPixel) + 7) / 8);
npm ERR!             ^
npm ERR! 9 warnings and 1 error generated.
npm ERR! make: *** [Release/obj.target/twain/src/TwainSession.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/username/.nvm/versions/node/v18.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:201:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/Users/username/.nvm/versions/node/v18.12.0/bin/node" "/Users/username/.nvm/versions/node/v18.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/username/Documents/projects/node-scanner/node_modules/node-twain
npm ERR! gyp ERR! node -v v18.12.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions