xorbit / node-aes-gcm

AES GCM module for node.js using OpenSSL
MIT License
34 stars 16 forks source link

Install Failed #12

Open paulyu12 opened 2 years ago

paulyu12 commented 2 years ago

npm install node-aes-gcm error. node v14.16.0 Windows 10 OpenSSL 1.1.1h

paulyu12 commented 2 years ago

install-error

xorbit commented 2 years ago

Not sure what to do about this, I don't use Windows, and don't have VS2017 Pro. I'm using node-gyp which is supposed to make things like these cross-platform. binding.gyp has this part for Windows:

            # "openssl_root" is the directory on Windows of the OpenSSL files
            ['target_arch=="x64"', {
              'variables': {
                'openssl_root%': 'C:/OpenSSL-Win64'
              },
          'libraries': ['<(openssl_root)/lib/<!@(dir /B C:\OpenSSL-Win64\lib\libeay32.lib C:\OpenSSL-Win64\lib\libcrypto.lib)'],
            }, {
              'variables': {
                'openssl_root%': 'C:/OpenSSL-Win32'
              },
          'libraries': ['<(openssl_root)/lib/<!@(dir /B C:\OpenSSL-Win32\lib\libeay32.lib C:\OpenSSL-Win32\lib\libcrypto.lib)'],
            }],

Do you have these OpenSSL files in their expected places?

Freedomhxb commented 2 years ago

me too, install failed

Freedomhxb commented 2 years ago

Traceback (most recent call last): File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 50, in sys.exit(gyp.script_main()) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp__init.py", line 554, in script_main return main(sys.argv[1:]) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp__init__.py", line 547, in main return gyp_main(args) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\init.py", line 520, in gyp_main [generator, flat_list, targets, data] = Load( File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\init__.py", line 136, in Load result = gyp.input.Load(build_files, default_variables, includes[:], File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 2782, in Load LoadTargetBuildFile(build_file, data, aux_data, File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 417, in LoadTargetBuildFile ProcessVariablesAndConditionsInDict( File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1299, in ProcessVariablesAndConditionsInDict ProcessVariablesAndConditionsInList(value, phase, variables, File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1315, in ProcessVariablesAndConditionsInList ProcessVariablesAndConditionsInDict(item, phase, variables, build_file) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1274, in ProcessVariablesAndConditionsInDict ProcessConditionsInDict(the_dict, phase, variables, build_file) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1152, in ProcessConditionsInDict ProcessVariablesAndConditionsInDict(merge_dict, phase, File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1274, in ProcessVariablesAndConditionsInDict ProcessConditionsInDict(the_dict, phase, variables, build_file) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1152, in ProcessConditionsInDict ProcessVariablesAndConditionsInDict(merge_dict, phase, File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1299, in ProcessVariablesAndConditionsInDict ProcessVariablesAndConditionsInList(value, phase, variables, File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 1319, in ProcessVariablesAndConditionsInList expanded = ExpandVariables(item, phase, variables, build_file) File "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 915, in ExpandVariables p_stderr = p_stderr.decode('utf-8') UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 4: invalid continuation byte gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16) gyp ERR! stack at ChildProcess.emit (events.js:400:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) gyp ERR! System Windows_NT 10.0.19042 gyp ERR! command "C:\soft\nodejs\node.exe" "C:\soft\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd D:\work\web_projects_2\uh-rdsp-meal-ticket-api\node_modules\node-aes-gcm gyp ERR! node -v v14.17.6 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok

Freedomhxb commented 2 years ago

@xorbit hello Can you help me solve the problem?

xorbit commented 2 years ago

As I mentioned above, I don't have Windows to try it on, sorry. Not sure if @paulyu12 ever solved his problem and may be able to share a solution?

ltinerary commented 2 years ago

try npm install node-aes-gcm --unsafe-perm

vidding commented 2 years ago

@Freedomhxb @paulyu12 I also failed to install it at the beginning. Later, I installed OpenSSL to C:\OpenSSL-Win64, and the installation was successful

paulyu12 commented 2 years ago

@Freedomhxb @paulyu12 I also failed to install it at the beginning. Later, I installed OpenSSL to C:\OpenSSL-Win64, and the installation was successful

I used the following solution to encrypt/decrypt. I'm not sure whether it helps or not.

image

xorbit commented 2 years ago

Thank you for posting the example @paulyu12! While I try to keep this package usable for those who have it integrated in their software, it was mostly a crutch to deal with the lack of support for GCM in node's crypto module at the time when I created it. Now the crypto module supports GCM, it would be best to migrate to that.