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' }
}
阅读更多

react-native-config 配置多包名&多环境 APKs 共存

以前都是准备几台不同的 android 手机安装不同环境的包,如果想一个手机安装不同环境的包,只能删了重新打然后重新安装。
解决问题的根本原因是,构建不同环境的包,假设我有三个环境

- Staging -> .env.Staging -> com.duolegamehelper.staging
- Alpha -> .env.alpha -> com.duolegamehelper.alpha
- Production -> .env.production -> com.duolegamehelper.production

那么我就打包的时候,通过不同的.env配置文件,动态的把包名和 APP 的名字打进去。
研究了半天,其实react-native-config是可以解决这个问题的,只不过需要修改打包的gradle脚本。

Snipaste 2024 02 11 15 10 28

阅读更多

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
阅读更多

Error installing lottie-ios

iOS安装lottie报错:

[!] Error installing lottie-ios
[!] /usr/local/bin/git clone https://github.com/airbnb/lottie-ios.git /var/folders/s4/d4hj6wbj1_j3w4ynthv1klf80000gn/T/d20240201-9298-1c37cjq --template= --single-branch --depth 1 --branch 4.4.0

正克隆到 '/var/folders/s4/d4hj6wbj1_j3w4ynthv1klf80000gn/T/d20240201-9298-1c37cjq'...
error: RPC 失败。curl 56 Recv failure: Connection reset by peer
error: 预期仍然需要 5466 个字节的正文
fetch-pack: unexpected disconnect while reading sideband packet
fatal: 过早的文件结束符(EOF)
fatal: index-pack 失败
阅读更多

Vue3.0 菜鸟儿🐤常见问题汇总

接手了公司的一个祖传项目,这尼玛Vue绝对是世界上最蛋疼的前端语言,研究了一下午连他怎么导出和引入的都没搞明白 …
经过了 N 番面向 ChatGPT 编程,基本算是入门了 …

注意看链接 🔗 名:vue-learning-tears … 这尼玛我是一把鼻涕一把泪学完的 …

组件封装

子组件通知父组件进行更新

Snipaste 2024 01 31 11 32 54

阅读更多

淘宝npm证书yarn报错(certificate has expired)

这尼玛大早上的来就给我报错,

error An unexpected error occurred: “https://registry.npm.taobao.org/@react-native-async-storage%2fasync-storage: certificate has expired”.

➜  chnqoo-recollections-mobile git:(main) yarn
yarn install v1.22.10
info No lockfile found.
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
error An unexpected error occurred: "https://registry.npm.taobao.org/@react-native-async-storage%2fasync-storage: certificate has expired".
info If you think this is a bug, please open a bug report with the information provided in "/Users/sunyg/chnqoo-recollections-mobile/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
阅读更多

tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

新项目执行pod install报错 …

xcode-select: error: tool ‘xcodebuild’ requires Xcode, but active developer directory ‘/Library/Developer/CommandLineTools’ is a command line tools instance

➜  ios git:(main) ✗ pod install
Ignoring ffi-1.14.2 because its extensions are not built. Try: gem pristine ffi --version 1.14.2
Auto-linking React Native modules for target `DuoleGameHelper`: RNCAsyncStorage, RNGestureHandler, RNScreens, and react-native-safe-area-context
Framework build type is static library
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
[Codegen] Found rncore
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
[!] Failed to load 'glog' podspec:
[!] Invalid `glog.podspec` file: undefined method `[]' for nil:NilClass.

# from /Users/sunyg/DuoleGameHelper/node_modules/react-native/third-party-podspecs/glog.podspec:38
# -------------------------------------------
# match = xcode_path.match(/Xcode (\d+)\.(\d+)/)
> major_version = match[1].to_i
# minor_version = match[2].to_i
# -------------------------------------------
阅读更多