Not authorized on admin to execute command

NextJS使用mongoose连接数据库的时候报错 …

MongoServerError: Authentication failed.
at Connection.onMessage (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/connection.js:205:26)
at MessageStream.<anonymous> (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/connection.js:64:60)
at MessageStream.emit (node:events:518:28)
at processIncomingData (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/message_stream.js:117:16)
at MessageStream._write (/Users/net.cctv3.i/chnqoo-recollections-service/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:564:12)
at _write (node:internal/streams/writable:493:10)
at Writable.write (node:internal/streams/writable:502:10)
at Socket.ondata (node:internal/streams/readable:1007:22)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
ok: 0,
code: 18,
codeName: 'AuthenticationFailed',
connectionGeneration: 0,
[Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}
阅读更多

NextJS加载不同环境的.env文件

NextJS默认加载的是.env.local,所以可以通过一个巧妙地办法,直接复制对应的文件到.env.local中,然后启动。

根目录添加不同环境的.env

➜  chnqoo-recollections-service git:(master) ✗ find . -type f -name ".env*"
./.env.production
./.env.local
./.env.alpha
./.env.staging
./.env.development
阅读更多

Failed to clone nvm repo. Please report this!

Linux安装nvm报错,连接GitHub超时 …

root@VM-4-9-debian:~/nvm-0.39.7# ./install.sh
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
fatal: unable to access 'https://github.com/nvm-sh/nvm.git/': Failed to connect to github.com port 443 af
ter 129382 ms: Couldn't connect to server
Failed to clone nvm repo. Please report this!
阅读更多

Unable to resolve module `./debugger-ui/debuggerWorker.d9da4ed7` from ``

公司的祖传代码升级,升级完了没法调试了 …

Error: Unable to resolve module `./debugger-ui/debuggerWorker.d9da4ed7` from ``:

None of these files exist:
* debugger-ui/debuggerWorker.d9da4ed7(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
* debugger-ui/debuggerWorker.d9da4ed7/index(.native|.native.js|.js|.native.json|.json|.native.ts|.ts|.native.tsx|.tsx)
at ModuleResolver.resolveDependency (/Users/sunyg/marineonline-mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:163:15)
at ResolutionRequest.resolveDependency (/Users/sunyg/marineonline-mobile/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/Users/sunyg/marineonline-mobile/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
at /Users/sunyg/marineonline-mobile/node_modules/metro/src/lib/transformHelpers.js:267:42
at /Users/sunyg/marineonline-mobile/node_modules/metro/src/Server.js:1305:37
at Generator.next (<anonymous>)
at asyncGeneratorStep (/Users/sunyg/marineonline-mobile/node_modules/metro/src/Server.js:99:24)
at _next (/Users/sunyg/marineonline-mobile/node_modules/metro/src/Server.js:119:9)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
::ffff:192.168.210.117 - - [18/Jan/2024:03:06:50 +0000] "POST /symbolicate HTTP/1.1" 500 - "-" "okhttp/4.8.1"
BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (1/1), done.

他奶奶的我就知道绝对是这个坑货搞的鬼 …

https://github.com/facebook/metro/issues/731

阅读更多