mosh-hamedani / vidly-api-node

309 stars 285 forks source link

npm install produces a lot of errors as shown below #23

Closed ybakhshi closed 4 years ago

ybakhshi commented 4 years ago

bcrypt@1.0.3 install C:\projects\vidly-api-node\node_modules\bcrypt node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v79-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@13.6.0 (node-v79 ABI) (falling back to source compile with node-gyp) node-pre-gyp ERR! Tried to download(undefined): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v79-win32-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.3 and node@13.6.0 (node-v79 ABI) (falling back to source compile with node-gyp) gyp ERR! find Python gyp ERR! find Python Python is not set from command line or npm configuration gyp ERR! find Python Python is not set from environment variable PYTHON gyp ERR! find Python checking if "python" can be used gyp ERR! find Python - "python" is not in PATH or produced an error gyp ERR! find Python checking if "python2" can be used gyp ERR! find Python - "python2" is not in PATH or produced an error gyp ERR! find Python checking if "python3" can be used gyp ERR! find Python - "python3" is not in PATH or produced an error gyp ERR! find Python checking if the py launcher can be used to find Python 2 gyp ERR! find Python - "py.exe" is not in PATH or produced an error gyp ERR! find Python checking if Python is C:\Python27\python.exe gyp ERR! find Python - "C:\Python27\python.exe" could not be run gyp ERR! find Python checking if Python is C:\Python37\python.exe gyp ERR! find Python - "C:\Python37\python.exe" could not be run gyp ERR! find Python gyp ERR! find Python ** gyp ERR! find Python You need to install the latest version of Python. gyp ERR! find Python Node-gyp should be able to find and use Python. If not, gyp ERR! find Python you can try one of the following options: gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe" gyp ERR! find Python (accepted by both node-gyp and npm) gyp ERR! find Python - Set the environment variable PYTHON gyp ERR! find Python - Set the npm configuration variable python: gyp ERR! find Python npm config set python "C:\Path\To\python.exe" gyp ERR! find Python For more information consult the documentation at: gyp ERR! find Python https://github.com/nodejs/node-gyp#installation gyp ERR! find Python ** gyp ERR! find Python gyp ERR! gypfind Python gyp ERR! ERR!find Python Python is not set from command line or npm configuration gypconfigure error ERR! find Python Python is not set from environment variable PYTHON gyp ERR! find Python checking if "python" can be used gyp ERR! find Python - "python" is not in PATH or produced an error gyp ERR! find Python checking if "python2" can be used gypgyp ERR! stack Error: Could not find any Python installation to use ERR!gyp ERR! find Pythonstack - "python2" is not in PATH or produced an error at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47) gypgyp ERR! stack at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21) ERR!gyp find PythonERR! checking if "python3" can be used gyp ERR! find Python - "python3" is not in PATH or produced an error gyp ERR! find Pythonstack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16) gyp ERR! stack at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16) gyp ERR! stack at exithandler (child_process.js:310:5) gyp ERR! stack at ChildProcess.errorhandler (child_process.js:322:5) gyp ERR! stack at ChildProcess.emit (events.js:321:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) gyp ERR! stack at onErrorNT (internal/child_process.js:469:16) gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding" gyp ERR! cwd C:\projects\vidly-api-node\node_modules\bcrypt gyp ERR! node -v v13.6.0 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok checking if the py launcher can be used to find Python 2 gyp ERR! find Python - "py.exe" is not in PATH or produced an error gyp ERR! find Python checking if Python is C:\Python27\python.exe gyp ERR! find Python - "C:\Python27\python.exe" could not be run gyp ERR! find Python checking if Python is C:\Python37\python.exe gyp ERR! find Python - "C:\Python37\python.exe" could not be run gyp ERR! find Python gyp ERR! find Python ** gyp ERR! find Python You need to install the latest version of Python. gyp ERR! find Python Node-gyp should be able to find and use Python. If not, gyp ERR! find Python you can try one of the following options: gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe" gyp ERR! find Python (accepted by both node-gyp and npm) gyp ERR! find Python - Set the environment variable PYTHON gyp ERR! find Python - Set the npm configuration variable python: gyp ERR! find Python npm config set python "C:\Path\To\python.exe" gyp ERR! find Python For more information consult the documentation at: gyp ERR! find Python https://github.com/nodejs/node-gyp#installation gyp ERR! find Python ** gyp ERR! find Python gyp ERR! configure error gyp ERR! stack Error: Could not find any Python installation to use gyp ERR! stack at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47) gyp ERR! stack at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16) gyp ERR! stack at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16) gyp ERR! stack at exithandler (child_process.js:310:5) gyp ERR! stack at ChildProcess.errorhandler (child_process.js:322:5) gyp ERR! stack at ChildProcess.emit (events.js:321:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) gyp ERR! stack at onErrorNT (internal/child_process.js:469:16) gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21) gyp ERR! System Windows_NT 10.0.18362 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding" gyp ERR! cwd C:\projects\vidly-api-node\node_modules\bcrypt gyp ERR! node -v v13.6.0 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding' (1) node-pre-gyp ERR! stack at ChildProcess. (C:\projects\vidly-api-node\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:321:20) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1028:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) node-pre-gyp ERR! System Windows_NT 10.0.18362 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\projects\vidly-api-node\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd C:\projects\vidly-api-node\node_modules\bcrypt node-pre-gyp ERR! node -v v13.6.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.36 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=C:\projects\vidly-api-node\node_modules\bcrypt\lib\binding' (1) npm WARN vidly@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! bcrypt@1.0.3 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@1.0.3 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\Yonus Bakhshi\AppData\Roaming\npm-cache_logs\2020-01-31T20_09_24_774Z-debug.log

I am taking the React course and so far progressed very well but right now i am stack here after setting the Mongodb but setting up the project vidly-api-node does not work.

Your help in this regard will be highly appreciated!

ybakhshi commented 4 years ago

@mosh-hamedani Hi Mosh, I am taking the React course and so far progressed very well but right now i am stack here after setting the Mongodb but setting up the project vidly-api-node does not work.

Your help in this regard will be highly appreciated!

FerasZiyad commented 4 years ago

Hi in the vidly-api-node file go to package.json file and change line 15 bcrypt version to 2.0.0 then run npm i should work

ybakhshi commented 4 years ago

@FerasZiyad Thanks! i resolved this issue another way! Are you doing this course too? Because i have following problem in authentication and authorization section image

Michael-U commented 4 years ago

@ybakhshi Greeting! could you please inform me how you were able to resolve this problem. I updated all dependencies to the latest but still got the same error. Then I reverted to the original package.json and changed line 15 ast @FerasZiyad suggested but didn't work for me . Here are my errors

npm WARN deprecated joi@13.7.0: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version t o get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial ). npm WARN deprecated hoek@5.0.4: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version t o get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial ). npm WARN deprecated topo@3.0.3: This module has moved and is now available at @hapi/topo. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues. npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues. npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart() npm WARN deprecated @types/winston@2.4.4: This is a stub types definition. winston provides its own type definitions, so you do not need this installed. npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies t o the actual version of core-js@3. npm WARN deprecated superagent@3.8.3: Please note that v5.0.1+ of superagent removes User-Agent header by default, therefore you may need to add it yourself (e.g. Gi tHub blocks requests without a User-Agent header). This notice will go away with v5.0.2+ once it is released.

bcrypt@2.0.1 install G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v79-win32-x64-unknown.tar.gz node-pre-gyp ERR! Pre-built binaries not found for bcrypt@2.0.1 and node@13.5.0 (node-v79 ABI, unknown) (falling back to source compile with node-gyp) gyp ERR! find Python gyp ERR! find Python Python is not set from command line or npm configuration gyp ERR! find Python Python is not set from environment variable PYTHON gyp ERR! find Python checking if "python" can be used gyp ERR! find Python - "python" is not in PATH or produced an error gyp ERR! find Python checking if "python2" can be used gyp ERR! find Python - "python2" is not in PATH or produced an error gyp ERR! find Python checking if "python3" can be used gyp ERR! find Python - "python3" is not in PATH or produced an error gyp ERR! find Python checking if the py launcher can be used to find Python 2 gyp ERR! find Python - "py.exe" is not in PATH or produced an error gyp ERR! find Python checking if Python is C:\Python27\python.exe gyp ERR! find Python - "C:\Python27\python.exe" could not be run gyp ERR! find Python checking if Python is C:\Python37\python.exe gyp ERR! find Python - "C:\Python37\python.exe" could not be run gyp ERR! find Python gyp ERR! find Python ** gyp ERR! find Python You need to install the latest version of Python. gyp ERR! find Python Node-gyp should be able to find and use Python. If not, gyp ERR! find Python you can try one of the following options: gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe" gyp ERR! find Python (accepted by both node-gyp and npm) gyp ERR! find Python - Set the environment variable PYTHON gyp ERR! find Python - Set the npm configuration variable python: gyp ERR! find Python npm config set python "C:\Path\To\python.exe" gyp ERR! find Python For more information consult the documentation at: gyp ERR! find Python https://github.com/nodejs/node-gyp#installation gyp ERR! find Python ** gyp ERR! find Python gyp ERR! configure error gyp ERR! stack Error: Could not find any Python installation to use gyp ERR! stack at PythonFinder.fail (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:307:47) gyp ERR! stack at PythonFinder.runChecks (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:136:21) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:225:16) gyp ERR! stack at PythonFinder.execFileCallback (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\find-python.js:271:16) gyp ERR! stack at exithandler (child_process.js:309:5) gyp ERR! stack at ChildProcess.errorhandler (child_process.js:321:5) gyp ERR! stack at ChildProcess.emit (events.js:305:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) gyp ERR! stack at onErrorNT (internal/child_process.js:469:16) gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" "--fallba ck-to-build" "--module=G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node" "--module_name=bcrypt_lib" "- -module_path=G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\lib\binding" "--napi_version=5" "--node_abi_napi=napi" gyp ERR! cwd G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt gyp ERR! node -v v13.5.0 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js con figure --fallback-to-build --module=G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib - -module_path=G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\lib\binding --napi_version=5 --node_abi_napi=napi' (1) node-pre-gyp ERR! stack at ChildProcess. (G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\node_modules\node-pre-gyp\lib\uti l\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:305:20) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1028:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) node-pre-gyp ERR! System Windows_NT 10.0.17134 node-pre-gyp ERR! command "C:\Program Files\nodejs\node.exe" "G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\node_modules\node -pre-gyp\bin\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt node-pre-gyp ERR! node -v v13.5.0 node-pre-gyp ERR! node-pre-gyp -v v0.9.1 node-pre-gyp ERR! not ok Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --mo dule=G:\Desktop\REACT COURSE\mastering-react\vidly-api-node\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=G:\Desktop\REACT C OURSE\mastering-react\vidly-api-node\node_modules\bcrypt\lib\binding --napi_version=5 --node_abi_napi=napi' (1) npm WARN vidly@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! bcrypt@2.0.1 install: node-pre-gyp install --fallback-to-build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the bcrypt@2.0.1 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\Michael-UCHE\AppData\Roaming\npm-cache_logs\2020-02-03T08_35_11_277Z-debug.log

ybakhshi commented 4 years ago

@Michael-U Follow these instructions:

Setting up the node backend

  1. Download and install git if you don’t have it
  2. Clone the vidly-api-node project: https://github.com/mosh-hamedani/vidly-api-node
  3. Go to this project
  4. Before running command: npm install , open the project and remove bcrypt from package.json
  5. Then run npm install
  6. Then run : npm uninstall --save bcrypt
  7. Then run: npm install --save bcrypt-nodejs
  8. Then replace bcrypt by bcrypt-nodejs in users.js and auth.js in routes folder
  9. Then open cmd in windows
  10. Type mongo
  11. type "use vidly" to use that db type db.users.insert( { "name":"Tom Hanks", "email":"tom@tom.com", "password":"234242" }) Now youve inserted and created a new collections called "users" with one object
  12. Go to vidly-api-node folder and open routes/users.js file insert this code to top after all the const declarations
  13. router.get("/", async (req, res) => { const users = await User.find(); res.send(users); });
  14. restart node using the "node index.js" command
  15. use postman and do a test call to http://localhost:3900/api/users
FerasZiyad commented 4 years ago

@ybakhshi yes I am doing this course too but I didn't get the authentication section when I get there I will let you know good Luck

FerasZiyad commented 4 years ago

@ybakhshi
are you sure the server was runing when you send the post request ?

ybakhshi commented 4 years ago

@FerasZiyad Yes , 100 percent !

FerasZiyad commented 4 years ago

@ybakhshi makes no sense the error happed because of the ordering was wrong so you have to first write email, password then name

ybakhshi commented 4 years ago

@FerasZiyad image

I deleted the users table and inserted again in the same order as you said but still i receive the same error when i try via postman

ybakhshi commented 4 years ago

I resolved this issue on windows 10 by replacing bcrypt by bcryptjs latest build. it works so far for me now!