vue报错:module.js:471 throw err;

$ cnpm run dev

> vue-my-project@1.0.0 dev C:\work\workspace\vscodeexercise\exercisecode\vue-my-project
> cross-env NODE_ENV=development webpack-dev-server --open --hot

module.js:471
    throw err;
    ^

Error: Cannot find module 'which'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\work\workspace\vscodeexercise\exercisecode\vue-my-project\node_modules\_cross-spawn@5.1.0@cross-spawn\lib\util\resolveCommand.js:4:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-my-project@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-my-project@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\32173\AppData\Roaming\npm-cache\_logs\2018-05-28T13_45_48_786Z-debug.log

xm@DESKTOP-LURMV9D MINGW64 /c/work/workspace/vscodeexercise/exercisecode/vue-my-project (master)
$ cnpm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\32173\AppData\Roaming\npm-cache\_logs\2018-05-28T13_52_06_800Z-debug.log

xm@DESKTOP-LURMV9D MINGW64 /c/work/workspace/vscodeexercise/exercisecode/vue-my-project (master)
$ npm cache verify
Cache verified and compressed (~\AppData\Roaming\npm-cache\_cacache):
Content verified: 3807 (110767375 bytes)
Content garbage-collected: 127 (9810220 bytes)
Index entries: 5798
Finished in 83.683s

xm@DESKTOP-LURMV9D MINGW64 /c/work/workspace/vscodeexercise/exercisecode/vue-my-project (master)
$ cnpm install
/ [7/13] Installing lodash@^4.17.10platform unsupported webpack-dev-server@2.11.2 › chokidar@2.0.3 › fsevents@^1.1.2 Package require os(darwin) not compatible with your platform(win32)
[fsevents@^1.1.2] optional install error: Package require os(darwin) not compatible with your platform(win32)
√ Installed 13 packages
√ Linked 628 latest versions
√ Run 1 scripts
Recently updated (since 2018-05-21): 14 packages (detail see file C:\work\workspace\vscodeexercise\exercisecode\vue-my-project\node_modules\.recently_updates.txt)  Today:
    → vue-loader@^13.0.5(13.7.2) (21:37:14)
    → vue-loader@13.7.2 › prettier@^1.7.0(1.13.0) (02:16:53)
    → file-loader@1.1.11 › webpack@3.12.0 › escope@3.6.0 › es6-weak-map@2.0.2 › es5-ext@^0.10.14(0.10.43) (21:37:06)
√ All packages installed (719 packages installed from npm registry, used 3m, speed 32.59kB/s, json 641(5.83MB), tarball 144.85kB)



解决方案:

1.删除文件夹node_modules

2.执行命令,如果第一指令不行,就用下一个

cnpm cache clean
npm cache verify

3.重新安装依赖

$npm install

4.运行

$npm run dev









  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值