reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
216 stars 327 forks source link

如何在 Node.js 环境里使用浏览器环境下的 document 对象 #662

Closed zhoubo20221107 closed 1 year ago

zhoubo20221107 commented 1 year ago

请按以下格式提供问题的相关信息。

问题的具体描述

今天使用 node.js运行 js 脚本时总是报错 ReferenceError: document is not defined

请描述完整的环境/版本信息

info Fetching system and libraries information... System: OS: Windows 10 10.0.19044 CPU: (4) x64 Intel(R) Core(TM) i3-6100 CPU @ 3.70GHz Memory: 2.27 GB / 7.95 GB Binaries: Node: 18.12.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-212.5712.43.2112.8609683 Visual Studio: Not Found Languages: Java: 11.0.17 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE npmPackages: @react-native-community/cli: Not Found react: ^18.2.0 => 18.2.0 react-native: 0.70.4 => 0.70.4 react-native-windows: Not Found npmGlobalPackages: react-native: Not Found

预期结果

可以在 Node.js 环境里使用浏览器环境下的 document 对象

sunnylqm commented 1 year ago

答案就是没有,不能

github-actions[bot] commented 1 year ago

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.