首页
登录 | 注册

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.执行命令,如果第一指令不行,就用下一个

3.重新安装依赖

$npm install

4.运行

$npm run dev










相关文章

  • 前端基础---JS基础
    背景介绍 Javascript 是一种运行在客户端的脚本语言 应用场景: 1.网页特效 2.服务端开发(Node.js) 3.命令行工具(Node.js) 4.桌面程序(Elextron) 5.APP(Cordova) 6.控制硬件-物联网 ...
  • 从虚拟化前端Bug学习分析Kernel Dump
    前言 也许大家都知道,分析 Kernel Dump 有个常用的工具叫 Crash,在我刚开始学习分析 Kernel Dump 的时候,总是花大量的时间折腾这个工具的用法,却总是记不住这个工具的功能.后来有一次在参加某次内部分享的时候,有位大 ...
  • 源码|详解分布式事务之 Seata-Client 原理及流程
    前言 在分布式系统中,分布式事务是一个必须要解决的问题,目前使用较多的是最终一致性方案.自年初阿里开源了Fescar(四月初更名为Seata)后,该项目受到了极大的关注,目前已接近 8000 Star.Seata 以高性能和零侵入的特性为目 ...
  • 字符串: 字符串用单引号(')或双引号(")括起来,不可变 1,find通过元素找索引,可切片,找不到返回-1 2,index,找不到报错. 3,split 由字符串分割成列表,默认按空格. 4,captalize 首字母大写,其 ...
  • 嗯...这个问题十分不好回答啊(捋下鱼须).闲鱼作为flutter领域的先驱者,以及fish_redux.flutter_boost等当红flutter库的作者,当然是欢迎广大的开发者多多使用flutter相关技术栈 逃~:).咳咳,不过呢 ...
  • Fish Redux中的Dispatch是怎么实现的?
    零.前言 我们在使用fish-redux构建应用的时候,界面代码(view)和事件的处理逻辑(reducer,effect)是完全解耦的,界面需要处理事件的时候将action分发给对应的事件处理逻辑去进行处理,而这个分发的过程就是下面要讲的 ...

2020 jeepshoe.net webmaster#jeepshoe.net
13 q. 0.374 s.
京ICP备10005923号