如何在 Debian 11 上安装 ReactJS
admin
2023-07-31 03:09:22
0

React 是一个开源 JavaScript 库,用于开发前端 Web 应用程序。它允许您为单页用户界面制作可重用的组件。它由 Facebook 和一个大型开发人员社区开发和维护。ReactJS 可用于开发 Web 应用程序或移动应用程序。

在 Debian 11 Bullseye 上安装 ReactJS

步骤 1. 在我们安装任何软件之前,通过apt在终端中运行以下命令来确保您的系统是最新的很重要:

sudo apt update
sudo apt upgrade
sudo apt install build-essential

步骤 2. 安装 Node.js。

Node.js 允许您在服务器端和浏览器之外运行 JavaScript。现在我们在 Debian 11 上手动添加官方 Node.js 存储库:

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -

成功添加存储库后,您现在可以使用以下命令安装Node.js:

sudo apt install nodejs

最后,使用以下命令检查 Node.js 版本:

node -v

检查 npm 版本:

npm -v

步骤 3. 在 Debian 11 上安装 React.js。

安装 node 和 npm 后,要创建应用程序,需要使用以下命令下载应用程序运行所需的必要依赖项:

npm install -g create-react-app

接下来,使用以下命令创建一个 React 应用程序:

create-react-app reactapp

输出:

Success! Created reactapp at /root/reactapp
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 reactapp
  npm start

然后,将目录更改为应用程序。注意:reactapp 是您要创建的应用程序的名称:

cd reactapp
npm start 0.0.0.0

输出:

> reactapp@0.1.0 start
> react-scripts start \"0.0.0.0\"
Compiled successfully!

You can now view reactapp in the browser.

  http://localhost:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

步骤 4. 访问 ReactJS Web 界面。

成功安装后,打开您的 Web 浏览器并使用 URL 测试您的 React 应用程序。你应该看到 React 默认页面:http://your-server-ip-address:3000

ReactJS-web-interfaceReactJS-web-interface

感谢您使用本教程在 Debian 11 Bullseye 上安装最新版本的 ReactJS。如需其他帮助或有用信息,我们建议您查看ReactJS 官方网站。

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
在 Windows 11 中打... 什么是链路状态电源管理? 您可以在系统控制面板的电源选项中看到链接状态电源管理。它是 PCI Exp...
如何在 iPhone 14 P... Apple 的 iPhone 14 Pro 是第一款配备 48MP 传感器的 iPhone。所有以前...
如何在电报Telegram中隐... 点击进入:ChatGPT工具插件导航大全 在Android上的电报中隐藏您的电话号码 您可以通过切换...
在 iCloud 上关闭“查找... 如果您是 Apple 的长期用户,您肯定会遇到过 Find My 应用程序,它本机安装在 iPhon...
Hive OS 部署 PXE ... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...