1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
sudo apt remove nodejs sudo apt purge nodejs sudo apt autoremove sudo apt remove npm #注意x是小写 curl https://deb.nodesource.com/setup_10.x > node.sh cat node.sh chmod +x node.sh sudo ./node.sh sudo apt-get install -y nodejs node –v npm –v sudo npm install -g cnpm --registry=https://registry.npm.taobao.org #解决ENOSPC报错问题 echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p #npm设置和取消代理的方法 设置代理(例如在公司的时候) npm config set proxy=http://127.0.0.1:8087 npm config set registry=http://registry.npmjs.org 取消代理(例如提示蓝灯端口不可用的时候) npm config delete proxy npm config delete https-proxy #初始化react项目 cd ~/dev mkdir nodejs cd nodejs npx create-react-app todolist #注意:为了速度和不报错,建议用cnpm命令替代npm cnpm install cnpm start |
本文作者: GavinDong
版权属于: GavinDong博客
文章链接: https://gavindong.com/2677.html
如果使用过程中遇到问题,可 **点击此处** 交流沟通。
版权所有,转载时必须以链接形式注明作者和原始出处及本声明。