如何完全安装/制作副本集而不会在 nodejs 中出错?

问题描述

我正在尝试将事务与 async/await 一起使用,为此我首先设置似乎无法正常工作的副本集。 我已经在我的系统中安装了 mongoDB。因此,为了使项目成为副本集,我在 Powershell/cmd 中使用以下命令:

npm install run-rs -g

run-rs -v

然后我收到以下错误。 如何解决这个问题?

 E:\grumpytext>run-rs -v
    Downloading MongoDB 4.0.12
    Exception calling "DownloadFile" with "2" argument(s): "The request was
    aborted: Could not create SSL/TLS secure channel."
    At line:1 char:59
    + &{Add-Type -AssemblyName System.IO.Compression.FileSystem;(New-Object
    Net.WebCli ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ~~~
        + CategoryInfo          : NotSpecified: (:) [],MethodInvocationException
        + FullyQualifiedErrorId : WebException

Exception calling "ExtractToDirectory" with "2" argument(s): "Could not find
file 'E:\grumpytext\mongodb-win32-x86_64-2008plus-ssl-4.0.12.zip'."
At line:1 char:231
+ &{Add-Type -AssemblyName System.IO.Compression.FileSystem;(New-Object
Net.WebCli ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : NotSpecified: (:) [],MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException

mv : Cannot find path
'E:\grumpytext\mongodb-win32-x86_64-2008plus-ssl-4.0.12\bin' because it does
not exist.
At line:1 char:335
+ &{Add-Type -AssemblyName System.IO.Compression.FileSystem;(New-Object
Net.WebCli ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
    + CategoryInfo          : ObjectNotFound: (E:\grumpytext\m...-ssl-4.0.12\b
   in:String) [Move-Item],ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.MoveI
   temCommand

rd : Cannot find path 'E:\grumpytext\mongodb-win32-x86_64-2008plus-ssl-4.0.12'
because it does not exist.
At line:1 char:459
+ ... run-rs/4.0.12';rd -r './mongodb-win32-x86_64-2008plus-ssl-4.0.12';rm
'./mongodb- ...
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (E:\grumpytext\m...plus-ssl-4.0.
   12:String) [Remove-Item],Microsoft.PowerShell.Commands.Remov
   eitemcommand

rm : Cannot find path
'E:\grumpytext\mongodb-win32-x86_64-2008plus-ssl-4.0.12.zip' because it does
not exist.
At line:1 char:510
+ ... us-ssl-4.0.12';rm './mongodb-win32-x86_64-2008plus-ssl-4.0.12.zip';}
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (E:\grumpytext\m...-ssl-4.0.12.z
   ip:String) [Remove-Item],Microsoft.PowerShell.Commands.Remov
   eitemcommand

copied MongoDB 4.0.12 to 'C:\Users\Sulekha Yadav\AppData\Roaming\npm\node_module
s\run-rs/4.0.12'
Purging database...
Running 'C:\Users\Sulekha Yadav\AppData\Roaming\npm\node_modules\run-rs\4.0.12\m
ongod.exe' [ 27017,27018,27019 ]
Starting replica set...
C:\Users\Sulekha Yadav\AppData\Roaming\npm\node_modules\run-rs\node_modules\mong
odb-topology-manager\lib\replset.js:124
            .toString()
             ^

TypeError: Cannot read property 'toString' of null
    at ChildProcess.<anonymous> (C:\Users\Sulekha Yadav\AppData\Roaming\npm\node
_modules\run-rs\node_modules\mongodb-topology-manager\lib\replset.js:124:14)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Socket.<anonymous> (internal/child_process.js:443:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:674:12)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)