FrontendMasters / api-design-node-v3

[Course] API design in Node with Express v3
https://frontendmasters.com/courses/api-design-nodejs-v3/
695 stars 965 forks source link

node modules installation ERROR #59

Open mustafaKamal-fe opened 4 years ago

mustafaKamal-fe commented 4 years ago

on initial installation [npm i ] or [yarn install] the (bcrypt) package is causing the installation process to fail. however, installing it on a separate line yeilds with 1926 vulnerabilities:

w:\devp\node\api-design-node-v3\node_modules\nan\nan_converters_43_inl.h(22): warning C4996: 'v8::Value::ToBoolean': was declared deprecated (compiling source file ..\src\bcrypt_node.cc) [W:\devp\node\api-design-node-v3\node_modules \bcrypt\build\bcrypt_lib.vcxproj] c:\users\freetw\appdata\local\node-gyp\cache\12.16.1\include\node\v8.h(2663): note: see declaration of 'v8::Value: :ToBoolean' (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\nan\nan_converters_43_inl.h(40): warning C4996: 'v8::Value::BooleanValu e': was declared deprecated (compiling source file ..\src\bcrypt_node.cc) [W:\devp\node\api-design-node-v3\node_modu les\bcrypt\build\bcrypt_lib.vcxproj] c:\users\freetw\appdata\local\node-gyp\cache\12.16.1\include\node\v8.h(2701): note: see declaration of 'v8::Value: :BooleanValue' (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\nan\nan_implementation_12_inl.h(356): error C2660: 'v8::StringObject::N ew': function does not take 1 arguments (compiling source file ..\src\bcrypt_node.cc) [W:\devp\node\api-design-node- v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] c:\users\freetw\appdata\local\node-gyp\cache\12.16.1\include\node\v8.h(5531): note: see declaration of 'v8::String Object::New' (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\nan\nan_implementation_12_inl.h(356): error C2059: syntax error: ')' (c ompiling source file ..\src\bcrypt_node.cc) [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vc xproj] w:\devp\node\api-design-node-v3\node_modules\nan\nan_object_wrap.h(24): error C2039: 'IsNearDeath': is not a member of 'Nan::Persistent<v8::Object,v8::NonCopyablePersistentTraits<T>>' [W:\devp\node\api-design-node-v3\node_modules\bc rypt\build\bcrypt_lib.vcxproj] with [ T=v8::Object ] (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\nan\nan.h(1920): note: see declaration of 'Nan::Persistent<v8::Object ,v8::NonCopyablePersistentTraits<T>>' with [ T=v8::Object ] (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\nan\nan_object_wrap.h(127): error C2039: 'IsNearDeath': is not a member of 'Nan::Persistent<v8::Object,v8::NonCopyablePersistentTraits<T>>' [W:\devp\node\api-design-node-v3\node_modules\b crypt\build\bcrypt_lib.vcxproj] with [ T=v8::Object ] (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\nan\nan.h(1920): note: see declaration of 'Nan::Persistent<v8::Object ,v8::NonCopyablePersistentTraits<T>>' with [ T=v8::Object ] (compiling source file ..\src\bcrypt_node.cc) w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(66): error C2664: 'v8::String::Utf8Value::Utf 8Value(const v8::String::Utf8Value &)': cannot convert argument 1 from 'v8::Local<v8::String>' to 'const v8::String: :Utf8Value &' [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(66): note: Reason: cannot convert from 'v8: :Local<v8::String>' to 'const v8::String::Utf8Value' w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(66): note: No user-defined-conversion opera tor available that can perform this conversion, or the operator cannot be called w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(121): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(121): error C2789: 'minor_ver': an object of const-qualified type must be initialized [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxpr oj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(121): note: see declaration of 'minor_ver' w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(150): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(150): error C2789: 'minor_ver': an object of const-qualified type must be initialized [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxpr oj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(150): note: see declaration of 'minor_ver' w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(212): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(212): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(213): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(213): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(231): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(231): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(232): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(232): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(312): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(312): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(313): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(313): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(331): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(331): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(332): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(332): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(352): error C2661: 'v8::Value::ToString': no overloaded function takes 0 arguments [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_lib.vcxproj] w:\devp\node\api-design-node-v3\node_modules\bcrypt\src\bcrypt_node.cc(352): error C2512: 'Nan::Utf8String::Utf8Stri ng': no appropriate default constructor available [W:\devp\node\api-design-node-v3\node_modules\bcrypt\build\bcrypt_ lib.vcxproj] gyp ERR! build error gyp ERR! stack Error:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exefailed with exit code: 1 gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:311:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) 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" "build" "--fallback-to-build" "--module=W:\\devp\\node\\api-design-node-v3\\node_modules\\bcrypt\\lib\\binding\\bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=W:\\devp\\node\\api-design-node-v3\\node_modules\\bcrypt\\lib\\binding" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72" gyp ERR! cwd W:\devp\node\api-design-node-v3\node_modules\bcrypt gyp ERR! node -v v12.16.1 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 build --fallback-to-build --module=W:\devp\node\api-design-node-v3\node_modules\bcrypt\lib\binding\bcrypt_lib.node --module_name=bcrypt_lib --module_path=W:\devp\node\api-design-node-v3\node_modules\bcrypt\lib\binding --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (W:\devp\node\api-design-node-v3\node_modules\bcrypt\node_modules\node-pre-gyp\lib\util\compile.js:83:29) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:311:20) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021: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" "W:\\devp\\node\\api-design-node-v3\\node_modules\\bcrypt\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd W:\devp\node\api-design-node-v3\node_modules\bcrypt node-pre-gyp ERR! node -v v12.16.1 node-pre-gyp ERR! node-pre-gyp -v v0.12.0 node-pre-gyp ERR! not ok

mantismamita commented 3 years ago

Looks like it doesn't work in node 12. I didn't have installation problems once I switched to node 10 using nvm.

mustafaKamal-fe commented 3 years ago

Looks like it doesn't work in node 12. I didn't have installation problems once I switched to node 10 using nvm. its a thing to maintain valuable yet a bit outdated courses.

Dev4mir commented 3 years ago

I faced this issue in master branch and solved it by changing bcrypt package to bcryptjs like lesson branches in package.json file: remove "bcrypt": "^3.0.2" and add "bcryptjs": "^2.4.3" in user.model.js file: replace the bcrypt package to be bcryptjs

bbernag commented 3 years ago

Fixed installing "bcrypt": "^5.0.0"