• React vscode 创建 react 项目流程


    一、安装node

    1. 请在官网下载安装:https://nodejs.org/zh-cn/
    2. vscode 中 点击 ( ctrl + `) 调出终端
    3. 输入指令node -v,能显示版本号,说明 node 已经装好了
    4. 输入指令npm -v,能显示版本号,说明 npm 可以使用了

    点击链接查看图文教程
    https://blog.csdn.net/qq_45677671/article/details/114535955

    二、配置淘宝镜像

    • 输入指令:
    • npm install -g cnpm --registry=https://registry.npm.taobao.org
    • 输入指令cnpm -v,能显示版本号,说明 cnpm 已经装好了

    三、配置 vscode(win10)

    win7 无需配置

    右击VSCode图标,选择属性,选择兼容性,勾选以管理员身份运行此程序,最后点击确定

    1. vscode 中 点击 ctrl + ` 调出终端
    2. 输入命令:get-ExecutionPolicy
    3. 输入命令:set-ExecutionPolicy RemoteSigned
    4. 输入命令:get-ExecutionPolicy
    • Restricted:表示禁止终端使用命令的
    • RemoteSigned:表示可以使用终端命令了

    四、全局安装脚手架

    • 在终端输入命令:npm install -g create-react-app

    • 这需要等待一段时间,这个过程在安装三个东西
    • react: react的顶级库
    • react-dom: react在web段的运行环境
    • react-scripts: 包含运行和打包react应用程序的所有脚本及配置

    五、创建项目

    • 先创建一个放置项目的文件夹www
    • 在终端中使用cd指令跳转到这个文件夹
    • 创建项目指令:create-react-app your-app(your-app是项目名,可以自己取)

    • 出现下面的界面,表示创建项目成功:
    Success! Created your-app at /dir/your-app
    Inside that directory, you can run several commands:
    
      npm start
        Starts the development server.
    
      npm run build
        Bundles the app into static files for production.
    
      npm test
        Starts the test runner.
    
      npm run eject
        Removes this tool and copies build dependencies, configuration files
        and scripts into the app directory. If you do this, you can’t go back!
    
    We suggest that you begin by typing:
    
      cd your-app
      npm start
    
    Happy hacking!
    • 通过cd your-app命令进入目录
    • 运行npm start即可运行项目
    • 生成项目的目录结构如下:
    ├── README.md            使用方法的文档
    ├── node_modules        所有的依赖安装的目录
    ├── package-lock.json    锁定安装时的包的版本号,保证团队的依赖能保证一致。
    ├── package.json                    
    ├── public                静态公共目录
    └── src                    开发用的源代码目录

    编写第一个 react 程序教程

    点击跳转:https://blog.csdn.net/qq_45677671/article/details/115874685

    Ref:(42条消息) React vscode 创建 react 项目流程【超详细】_一颗不甘坠落的流星的博客-CSDN博客

  • 相关阅读:
    线程的start和run方法的区别
    GC相关的面试题
    AVR单片机教程——EasyElectronics Library v1.3手册
    我回来了
    继续停更通知
    停更通知
    玩玩24点(上)
    AVR单片机教程——EasyElectronics Library v1.2手册
    AVR单片机教程——数码管
    算法基础课程总结
  • 原文地址:https://www.cnblogs.com/cy0628/p/15619224.html
Copyright © 2020-2023  润新知