编程语言
首页 > 编程语言> > deepin 编程环境搭建 - 安装NVM & node & vue-cli

deepin 编程环境搭建 - 安装NVM & node & vue-cli

作者:互联网

# 更新系统
sudo apt update -y
sudo apt upgrade -y
# 安装git
sudo apt install git -y
# 安装wget
sudo apt install wget -y
# 安装nvm
	# 下载源码
	git clone https://github.com/nvm-sh/nvm.git ~/.nvm
	# 切换目录
	cd ~/.nvm
	# 安装 会去下载东西。可能下载失败,换个网络试试(我用自己热点下载成功)
	./install.sh
	# 添加淘宝镜像
	export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/dist
	# 重启配置文件
	source ~/.bashrc
# 安装node
nvm install 10.15.3
# 使用下载的 10.15.3
nvm use 10.15.3
# 再检查以下版本
node -v
npm -v
# npm更换阿里源
npm config set registry https://registry.npm.taobao.org/
# 检查是否更新成功
npm config get registry
# 安装 vue-cli
npm install -g @vue/cli

# 防止报错 大项目运行会报错
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo sysctl --system

参考:
Deepin下NVM安装[npm + node]

node.js 版本控制工具 nvm 的安装和使用

npm更换阿里源

vue-cli 安装

ps:vue项目运行报错
报错信息:

ℹ 「wds」: Content not from webpack is served from /media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/public
ℹ 「wds」: 404s will fallback to /index.html
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/public'
    at FSWatcher.start (internal/fs/watchers.js:165:26)
    at Object.watch (fs.js:1253:11)
    at createFsWatchInstance (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:38:15)
    at setFsWatchListener (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:233:14)
    at FSWatcher.NodeFsHandler._handleDir (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:429:19)
    at FSWatcher.<anonymous> (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:477:19)
    at FSWatcher.<anonymous> (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:482:16)
    at FSReqWrap.oncomplete (fs.js:154:5)
Emitted 'error' event at:
    at FSWatcher._handleError (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/index.js:260:10)
    at createFsWatchInstance (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:40:5)
    at setFsWatchListener (/media/cb1000n/marchsoft/all-workspace/all-project/小云通知/框架/smpe-admin-web/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:81:15)
    [... lines matching original stack trace ...]
    at FSReqWrap.oncomplete (fs.js:154:5)

解决方案:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo sysctl --system

参考:https://blog.csdn.net/wjx666666/article/details/101980721

标签:node,web,vue,cli,cb1000n,modules,js,小云
来源: https://blog.csdn.net/qq_42909053/article/details/115408511