今天vue项目本来跑的很正常突然莫名其妙就出现了错误(我根本没有改动代码??),慌得一批,又整了半小时终于复原了
依赖项真的莫名其妙的bug令人心力交瘁

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throw_npm


删除了node_modules

尝试了的命令:

npm install npm@latest -g

npm cache clean -f

npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm install

再次npm run dev又说有依赖没找到:

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throw_npm_02


npm i element-ui -S


npm run dev

成功了。

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throw_vue_03


另外还有一些可能用得到的命令:

快速删除:
利用npm:输入
npm install rimraf -g
rimraf node_modules

更新(up, upgrade)

输入:npm update [][-g]/[–save][-dev]

卸载(remove、rm、r, un、unlink)

输入:npm uninstall [][-g]/[–save][-dev]