简体   繁体   中英

error installing argon2 using npm install in node js (node-gyp) error

I tried to install argon 2 on node js using npm install argon2 --save . I think there is a problem with python (not sure why) or with node-gyp.

PS C:\angular\backend> npm install argon2 --save

> argon2@0.21.0 install C:\angular\backend\node_modules\argon2
> node-gyp rebuild


C:\angular\backend\node_modules\argon2>if not defined npm_config_node_gyp (node "C:\Users\matan\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\matan\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\matan\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:276:12)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:915:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\matan\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\angular\backend\node_modules\argon2
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'C:\angular\backend\package.json'
npm WARN backend No description
npm WARN backend No repository field.
npm WARN backend No README data
npm WARN backend No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! argon2@0.21.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the argon2@0.21.0 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\matan\AppData\Roaming\npm-cache\_logs\2019-04-30T13_02_07_305Z-debug.log
PS C:\angular\backend>


expected argon2 to be installed to later be used for hashing.

From your anaconda path it looks like you were using Python 3.

gyp ERR! stack Error: Command failed: C:\Users\matan\Anaconda3\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax

That would explain the syntax error at the print statement since it is not a print function. Try installing python2, or if you already have it installed, make sure it is on the path before python3.

its so simple to handle this error if you follow my step you can resolve all error in gyp in nodejs in windows os .

STEP1 : goto this link

find and download and install build tools for visual studio 2019 download and install it , and check nodejs tick , and restart your pc.

STEP2: install python 2.7 and sure that itis in your path , and u can access that with python (not python2)

STEP 3 : install this package fom npm https://www.npmjs.com/package/windows-build-tools make sure using powershell

then can install argon2 or any package you want :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM