目录
Node.js
安装Node.js
As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications. In the following "hello world" example, many connections can be handled concurrently. Upon each connection, the callback is fired, but if there is no work to be done, Node.js will sleep.
作为一个异步事件驱动的JS运行时,Node.js被设计成可扩展的网络应用程序。可以同时处理很多任务,每个连接都会被触发,如果没有被使用,Node.js将会休眠。
官方下载并安装,并自动安装一些必须的工具,否则编译时可能会报版本冲突的问题。
Linux环境下:
安装nodejs V8
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
安装nodejs V9 curl --silent --location https://rpm.nodesource.com/setup_9.x | sudo bash -
yum install -y nodejs
查下Node.js的版本
D:\nodejs>node --version
v16.8.0
or
D:\nodejs>node -v
v16.8.0
Uninstalling the Node.js in Windows
安装chocolatey
THE PACKAGE MANAGER FOR WINDOWS Modern Software Automation
Windows软件包自动管理软件
Node.js 最新的版本,比如v20.x 已经默认安装chocolatey
C:\ProgramData\chocolatey\bin
ProgramData 文件夹是隐藏文件,需要打开
升级choco upgrade chocolatey
C:\ProgramData\chocolatey\bin>choco upgrade chocolatey
Chocolatey v0.10.15
Upgrading the following packages:
chocolatey
By upgrading you accept licenses for the packages.
chocolatey v0.10.15 is the latest version available based on your source(s).
Yarn
安装yarn
C:\ProgramData\chocolatey\bin>choco install yarn
Download of yarn-1.22.5.msi (1.57 MB) completed.
Hashes match.
Installing yarn...
yarn has been installed.
默认下载C:\Users\当前用户\AppData\Local\Temp\chocolatey\yarn\1.22.5\yarn-1.22.5.msi
默认安装在C:\Program Files (x86)\Yarn\ 下
D:\IDE\Yarn\bin>yarn --version
1.22.5
Linux环境下
sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
sudo yum install -y yarn
yarn 启动项目
yarn install 安装依赖
yarn run serve 运行
yarn run build 编译