docs: add post-9 post-10
This commit is contained in:
1 parent
cd8865feb4
commit
c6ba3d3ea2
3 files changed
+100
No files matched your search
@@ -0,0 +1,23 @@
|
||||
# React 入门
|
||||
|
||||
学完了 1+1,我们可以开始学习微积分了。(🐶 保命)
|
||||
|
||||
## 创建一个 React 工程
|
||||
|
||||
我们使用 create react app 手脚架快速创建工程,其中包含工具,但是没有必要每个都了解。
|
||||
|
||||
1. 找一个空的文件夹,打开控制台(按住 shift,右键打开控制台),输入如下命令。
|
||||
|
||||
```
|
||||
npx create-react-app my-app
|
||||
```
|
||||
|
||||
视网络状况,可能需要 30s - 1min ,如果过久的话,建议不要等了。
|
||||
|
||||
2. 进入到项目文件夹中,启动项目
|
||||
|
||||
```
|
||||
cd my-app
|
||||
npm start
|
||||
```
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
# Hello Node JS
|
||||
|
||||
假如安装好了 Node,如何验证安装好了?或者我怎么使用它?
|
||||
|
||||
## 验证是否安装成功
|
||||
|
||||
打开一个控制台
|
||||
|
||||
<Tabs
|
||||
defaultValue="win"
|
||||
values={[
|
||||
{ label: "win", value: "win" },
|
||||
{ label: "ubuntu", value: "ubuntu" },
|
||||
{ label: "mac", value: "mac" },
|
||||
]}
|
||||
>
|
||||
<TabItem value="win">
|
||||
在开始菜单上右键,点击windows 终端(管理员)
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="ubuntu">
|
||||
Ctrl+Alt+T
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="mac">
|
||||
找到terminal app,然后打开。
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
输入
|
||||
|
||||
```
|
||||
node -v
|
||||
```
|
||||
|
||||
然后你会看到你安装的 node 版本。
|
||||
|
||||
例如,我的版本
|
||||
|
||||
```
|
||||
v14.18.0
|
||||
```
|
||||
|
||||
## 使用
|
||||
|
||||
> 用最少的知识量,让程序完整的跑起来,就是 Hello World 的目的。
|
||||
|
||||
本篇的完整代码,可以在这里找到:
|
||||
|
||||
- [examples/post-9/hello.js](https://github.com/idealjs/web-tutorial/blob/main/examples/post-9/hello.js)
|
||||
|
||||
在有 hello.js 的文件夹下打开控制台(在文件夹下按住 shift 鼠标右击),并且输入
|
||||
|
||||
```sh
|
||||
node hello.js
|
||||
```
|
||||
|
||||
如果碰到了如下错误,那么可能是当前文件夹下没有 hello.js 这个文件。
|
||||
|
||||
```
|
||||
internal/modules/cjs/loader.js:905
|
||||
throw err;
|
||||
^
|
||||
|
||||
Error: Cannot find module 'xxx/xxx/hello.js'
|
||||
```
|
||||
|
||||
正常运行的话,会显示如下
|
||||
|
||||
```
|
||||
hello world
|
||||
```
|
||||
Reference in new issue
Block a user