brew install node? ?//? ? ? 安裝 node? //安裝的路徑在:?/opt/homebrew/bin/node
brew install node14? //?brew install node@22? ?// 安裝指定版本
如果需要設置環境變量:通過: which node? 查找路徑
export PATH="/usr/local/opt/node@<version>/bin:$PATH"
通過:source ~/.zshrc? ?//?進行更改生效
npm?查看鏡像源:?npm get registry
配置nodejs(npm 國內鏡像)
https://blog.csdn.net/weixin_45565886/article/details/141828707
mac2024 安裝node和vue_mac nodejs-CSDN博客? ? //?安裝vue
npm install -g @vue/cli
npm run serve //?運行項目
然后進入?目錄安裝 element-plus :npm install element-plus --save
# 配置npm
npm config set registry https://registry.npmmirror.com #設置國內阿里云鏡像源
npm config get registry #查看鏡像源npm init: 項目初始化;
npm init -y:默認一路yes,不用挨個輸入信息
npm install 包名:安裝js包到項目中(僅當前項目有效)。指定 包名,或者 包名@版本號
npm install -g: 全局安裝,所有都能用
可以去 npm倉庫 搜索第三方庫
npm update 包名:升級包到最新版本
npm uninstall 包名:卸載包
npm run:項目運行
如果想切換淘寶鏡像源,輸入以下命令
npm set registry https://registry.npm.taobao.org/?
如果想換回官方鏡像源,輸入以下命令
npm config set registry https://registry.npmjs.org/
————————————————
vscode中創建vue項目
在VSCode中創建Vue項目,你可以使用Vue CLI工具。以下是創建Vue項目的步驟:
-
確保你已經安裝了Node.js和npm。
-
安裝Vue CLI:
npm install -g @vue/cli
-
創建一個新的Vue項目:
vue create my-vue-project
其中
my-vue-project
是你的項目名稱。 -
進入項目文件夾:
cd my-vue-project
-
運行項目:
npm run serve
以上步驟會創建一個新的Vue項目,并啟動一個開發服務器,你可以在瀏覽器中訪問這個項目。
執行前需要卸載已有node
sudo npm uninstall npm -g
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
驗證
node -v //not found