From c6ba3d3ea24edb479facc596608cd452769af701 Mon Sep 17 00:00:00 2001 From: cqh963852 Date: Sat, 5 Feb 2022 22:30:10 +0800 Subject: [PATCH] docs: add post-9 post-10 --- docs/post-10.md | 23 ++++++++++++ docs/post-9.mdx | 76 ++++++++++++++++++++++++++++++++++++++++ examples/post-9/hello.js | 1 + 3 files changed, 100 insertions(+) create mode 100644 docs/post-10.md create mode 100644 docs/post-9.mdx create mode 100644 examples/post-9/hello.js diff --git a/docs/post-10.md b/docs/post-10.md new file mode 100644 index 0000000..facb318 --- /dev/null +++ b/docs/post-10.md @@ -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 + ``` + diff --git a/docs/post-9.mdx b/docs/post-9.mdx new file mode 100644 index 0000000..1780677 --- /dev/null +++ b/docs/post-9.mdx @@ -0,0 +1,76 @@ +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + +# Hello Node JS + +假如安装好了 Node,如何验证安装好了?或者我怎么使用它? + +## 验证是否安装成功 + +打开一个控制台 + + + + 在开始菜单上右键,点击windows 终端(管理员) + + + + Ctrl+Alt+T + + + + 找到terminal app,然后打开。 + + + + +输入 + +``` +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 +``` diff --git a/examples/post-9/hello.js b/examples/post-9/hello.js new file mode 100644 index 0000000..6b2b3db --- /dev/null +++ b/examples/post-9/hello.js @@ -0,0 +1 @@ +console.log("hello world");