大佬,这个报错是怎么回事(阿里的ecs,centos7.5_x64) 223.104.119.84:2892 –> 21zwx001 保存数据失败: MongoError: command insert requires authentication at Connection.<anonymous> (/root/soft-and-hard/demo2/myapp/node_modules/mongodb/lib/core/connection/pool.js:453:61) at Connection.emit (node:events:513:28) at processMessage (/root/soft-and-hard/demo2/myapp/node_modules/mongodb/lib/core/connection/connection.js:456:10) at Socket.<anonymous> (/root/soft-and-hard/demo2/myapp/node_modules/mongodb/lib/core/connection/connection.js:625:15) at Socket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { ok: 0, code: 13, codeName: ‘Unauthorized’}
@xianyu , 这明显是数据库验证失败了。 先验证一下数据库怎么在代码里才能登陆成功。
《叹为观止》
esp8266与本地连的时候,看串口打印信息,显示host connected和tem交替打印,意思是client.connect(host,port)返回了1,client.connected()返回了0,这是什么原因
@Anonymous , 我看了一下,client.connect(host,port)返回了1代表成功连接。 client.connected()返回了0代表连不上,那么是不会打印item的。正常是先打印host connected!,然后就一直打印tem:不断+1的数,这才是正常的。交替打印的话可能是哪里有问题,需要排查一下。(可能 硬件在不断重启?)
<!-- * @Author: wyx * @Date: 2024-10-09 18:19:49 * @LastEditors: wyx * @LastEditTime: 2024-10-10 11:39:11 * @Description: file content -->
<template> <div ref="threejsContainer" class="threejs-container"></div></template>
<script>import * as THREE from “three”;import { OrbitControls } from “three/examples/jsm/controls/OrbitControls.js”;import { GLTFLoader } from “three/examples/jsm/loaders/GLTFLoader.js”;import TWEEN from “@tweenjs/tween.js”;export default { name: “ThreeJsScene”, data() { return { scene: null, camera: null, renderer: null, orbit: null, door: null, raycasterObjects: [], raycaster: new THREE.Raycaster(), mouse: new THREE.Vector2(), }; }, mounted() { this.initThreeJs(); }, methods: { initThreeJs() { this.scene = new THREE.Scene(); this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); this.camera.position.x = 2; this.renderer = new THREE.WebGLRenderer(); this.renderer.setSize(window.innerWidth, window.innerHeight); this.$refs.threejsContainer.appendChild(this.renderer.domElement); this.orbit = new OrbitControls(this.camera, this.renderer.domElement); const light = new THREE.HemisphereLight(0xffffff, 0xcccccc, 1); this.scene.add(light); const loader = new GLTFLoader(); loader.load(“/door/open-door.glb”, (gltf) => { this.scene.add(gltf.scene); this.door = this.scene.getObjectByName(“door”); if (this.door) { this.door.userData.openFlag = false; this.raycasterObjects.push(this.door); } this.animate(); }); window.addEventListener(“click”, this.onMouseClick, false); }, animate() { TWEEN.update(); requestAnimationFrame(this.animate); this.renderer.render(this.scene, this.camera); }, triggerDoor() { const targetRotation = this.door.userData.openFlag ? 0 : Math.PI / 2; new TWEEN.Tween(this.door.rotation) .to({ y: targetRotation }, 1000) .onUpdate((val) => { this.door.rotation.y = val.y; }) .start(); this.door.userData.openFlag = !this.door.userData.openFlag; //console.log(‘111111111111’,this.door); }, onMouseClick(event) { this.mouse.x = (event.clientX / window.innerWidth) * 2 - 1; this.mouse.y = - (event.clientY / window.innerHeight) * 2 + 1; this.raycaster.setFromCamera(this.mouse, this.camera); const intersects = this.raycaster.intersectObjects(this.raycasterObjects); if (intersects.length > 0 && intersects[0].object === this.door) { this.triggerDoor(); } } }, beforeDestroy() { window.removeEventListener(“click”, this.onMouseClick, false); this.renderer.dispose(); }};</script>
<style scoped>.threejs-container { width: 100%; height: 100vh;}</style>
为什么用了博主的blender的门glb和源代码,还是动不起来?写在vue里的时候,TWEEN.update()显示警告‘update’ is deprecated
@Anonymous , 应该是库版本的问题,你在我的项目代码里跑正常就代表正常。TWEEN.update()显示警告‘update’ is deprecated 。 这意思是update这个函数已经被改名了,可以去查一下新版的函数名改成什么。
你是一个有故事的人
无法获取设备id是怎么回事?每次都是默认的id:123456,但是能够在数据库中找到esp8266上传的数据
@Anonymous , 可以加Q群发截图,会有协助解答。
?
http一直连不上去,报文发送不成功
@Anonymous , 浏览器能否打开页面?如果浏览器能打开页面,但调试助手报文发送不成功,检查调试助手的配置再尝试。
博主,程序中地址写的电脑对应IP,为什么没办法登录对应服务器
@Anonymous , 根据大家的情况,最常见的原因是没有关闭windows防火墙导致的,可以检查 一下。
大佬,这个报错是怎么回事(阿里的ecs,centos7.5_x64)
223.104.119.84:2892 –> 21
zwx001 保存数据失败: MongoError: command insert requires authentication
at Connection.<anonymous> (/root/soft-and-hard/demo2/myapp/node_modules/mongodb/lib/core/connection/pool.js:453:61)
at Connection.emit (node:events:513:28)
at processMessage (/root/soft-and-hard/demo2/myapp/node_modules/mongodb/lib/core/connection/connection.js:456:10)
at Socket.<anonymous> (/root/soft-and-hard/demo2/myapp/node_modules/mongodb/lib/core/connection/connection.js:625:15)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
ok: 0,
code: 13,
codeName: ‘Unauthorized’
}
@xianyu , 这明显是数据库验证失败了。 先验证一下数据库怎么在代码里才能登陆成功。
《叹为观止》
esp8266与本地连的时候,看串口打印信息,显示host connected和tem交替打印,意思是client.connect(host,port)返回了1,client.connected()返回了0,这是什么原因
@Anonymous , 我看了一下,client.connect(host,port)返回了1代表成功连接。 client.connected()返回了0代表连不上,那么是不会打印item的。
正常是先打印host connected!,然后就一直打印tem:不断+1的数,这才是正常的。交替打印的话可能是哪里有问题,需要排查一下。(可能 硬件在不断重启?)
<!-- * @Author: wyx * @Date: 2024-10-09 18:19:49 * @LastEditors: wyx * @LastEditTime: 2024-10-10 11:39:11 * @Description: file content -->
<template>
<div ref="threejsContainer" class="threejs-container"></div>
</template>
<script>
import * as THREE from “three”;
import { OrbitControls } from “three/examples/jsm/controls/OrbitControls.js”;
import { GLTFLoader } from “three/examples/jsm/loaders/GLTFLoader.js”;
import TWEEN from “@tweenjs/tween.js”;
export default {
name: “ThreeJsScene”,
data() {
return {
scene: null,
camera: null,
renderer: null,
orbit: null,
door: null,
raycasterObjects: [],
raycaster: new THREE.Raycaster(),
mouse: new THREE.Vector2(),
};
},
mounted() {
this.initThreeJs();
},
methods: {
initThreeJs() {
this.scene = new THREE.Scene();
this.camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
this.camera.position.x = 2;
this.renderer = new THREE.WebGLRenderer();
this.renderer.setSize(window.innerWidth, window.innerHeight);
this.$refs.threejsContainer.appendChild(this.renderer.domElement);
this.orbit = new OrbitControls(this.camera, this.renderer.domElement);
const light = new THREE.HemisphereLight(0xffffff, 0xcccccc, 1);
this.scene.add(light);
const loader = new GLTFLoader();
loader.load(“/door/open-door.glb”, (gltf) => {
this.scene.add(gltf.scene);
this.door = this.scene.getObjectByName(“door”);
if (this.door) {
this.door.userData.openFlag = false;
this.raycasterObjects.push(this.door);
}
this.animate();
});
window.addEventListener(“click”, this.onMouseClick, false);
},
animate() {
TWEEN.update();
requestAnimationFrame(this.animate);
this.renderer.render(this.scene, this.camera);
},
triggerDoor() {
const targetRotation = this.door.userData.openFlag ? 0 : Math.PI / 2;
new TWEEN.Tween(this.door.rotation)
.to({ y: targetRotation }, 1000)
.onUpdate((val) => {
this.door.rotation.y = val.y;
})
.start();
this.door.userData.openFlag = !this.door.userData.openFlag;
//console.log(‘111111111111’,this.door);
},
onMouseClick(event) {
this.mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
this.mouse.y = - (event.clientY / window.innerHeight) * 2 + 1;
this.raycaster.setFromCamera(this.mouse, this.camera);
const intersects = this.raycaster.intersectObjects(this.raycasterObjects);
if (intersects.length > 0 && intersects[0].object === this.door) {
this.triggerDoor();
}
}
},
beforeDestroy() {
window.removeEventListener(“click”, this.onMouseClick, false);
this.renderer.dispose();
}
};
</script>
<style scoped>
.threejs-container {
width: 100%;
height: 100vh;
}
</style>
为什么用了博主的blender的门glb和源代码,还是动不起来?写在vue里的时候,TWEEN.update()显示警告‘update’ is deprecated
@Anonymous , 应该是库版本的问题,你在我的项目代码里跑正常就代表正常。
TWEEN.update()显示警告‘update’ is deprecated 。 这意思是update这个函数已经被改名了,可以去查一下新版的函数名改成什么。
你是一个有故事的人
无法获取设备id是怎么回事?每次都是默认的id:123456,但是能够在数据库中找到esp8266上传的数据
@Anonymous , 可以加Q群发截图,会有协助解答。
?
http一直连不上去,报文发送不成功
@Anonymous , 浏览器能否打开页面?如果浏览器能打开页面,但调试助手报文发送不成功,检查调试助手的配置再尝试。
博主,程序中地址写的电脑对应IP,为什么没办法登录对应服务器
@Anonymous , 根据大家的情况,最常见的原因是没有关闭windows防火墙导致的,可以检查 一下。
v1.4.14