开发中有偶尔出现无法代码热加载的问题, (注:这里代码热加载指的是npm run dev
下,修改了代码,无法自动的检测到代码的更新,需要中止命令并重新npm run dev
才能生效)
之前重装了一次node
解决了问题
目前的node
是官方下载的v7.10.0
, npm
是4.2.0
➜ ~ node -v
v7.10.0
➜ ~ npm -v
4.2.0
但是在更新了系统以后, 再次出现了无法热加载的问题
系统是
Linux work 4.9.0-deepin9-amd64 #1 SMP PREEMPT Deepin 4.9.29-4 (2017-07-17) x86_64 GNU/Linux
更新系统的命令是sudo apt-get install dist-upgrade -y
再次查看指向,路径没有发生变化的
➜ ~ which node
/home/d/node-v7.10.0-linux-x64/bin/node
➜ ~ which npm
/home/d/node-v7.10.0-linux-x64/bin/npm
启动运行的命令是
➜ frontend git:(master) ✗ npm run dev
> test@1.0.0 dev /home/d/Desktop/vue-frame/frontend
> node build/dev-server.js
[HPM] Proxy created: /api/** -> http://127.0.0.1:10086
[HPM] Proxy created: /ws/** -> ws://127.0.0.1:10086
> Starting dev server...
DONE Compiled successfully in 12338ms 12:25:07
> Listening at http://127.0.0.1:8080/
奇怪的是,使用sudo npm run dev
却可以代码热加载,
但是使用的浏览器是chrome
, 会报如下错误
不能以根用户身份运行Google Chrome。
请以普通用户的身份启动 Google Chrome。如果您出于开发目的,需要以根用户的身份运行 Chrome,请使用 --no-sandbox 标记重新运行 Chrome。
以回车取消了提示后,终端会显示以下代码
(node:20981) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Exited with code 3
(node:20981) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
同时也尝试过删除项目下的node_modules
,重新的cnpm install
一次,问题依旧没有解决
问题:
- 请问是因为系统更新的操作导致
vue(or webpack?)
出现无法代码热加载的问题的吗 - 需要怎么修改才能变回原来的不带
sudo
就可以代码热加载 - 请指教