การกำหนดค่าเกี่ยวกับ Node.js
การกำหนดค่าเส้นทางการติดตั้ง npm ทั่วโลกและเส้นทางแคช
สร้างโฟลเดอร์ใหม่สองโฟลเดอร์ node_cache และ node_global ในไดเรกทอรีรูท nvm หากคุณยังไม่เคยติดตั้ง npm คุณสามารถใช้ nvm install --lts เพื่อติดตั้งเวอร์ชันเสถียรล่าสุดและใช้กับ nvm use <version-number> หรือระบุเวอร์ชันด้วย nvm install <version-number>
การกำหนดค่าเส้นทาง cache และ prefix ของ npm
bash
npm config set cache "D:\nvm\node_cache"
npm config set prefix "D:\nvm\node_prefix"ตรวจสอบเส้นทางแคชและการติดตั้งทั่วโลกของ npm
bash
npm config get cache
npm config get prefixตรวจสอบ npm Registry
bash
npm config get registryการกำหนดค่า npm Registry
bash
npm config set registry https://registry.npmmirror.comมิเรอร์ Registry ที่มีให้
- มิเรอร์ NPM Taobao: https://registry.npmmirror.com
- มิเรอร์ cnpm: http://r.cnpmjs.org
- npm Registry อย่างเป็นทางการ: https://registry.npmjs.org
- มิเรอร์ NPM Tencent Cloud: https://mirrors.cloud.tencent.com/npm/ (สำหรับมิเรอร์โอเพนซอร์สที่มีให้เพิ่มเติม ไปที่ Available Open Source Mirrors)
- มิเรอร์ NPM Huawei Cloud: https://mirrors.huaweicloud.com/repository/npm/
- มิเรอร์ Beijing Foreign Studies University: https://mirrors.bfsu.edu.cn/nodejs-release/npm/