cnpm run dev启动报错,解决办法

启动vue.js项目时,报如下错误,是因为依赖的包没有导进来(大部分情况出现在git别人项目时)

module.js:538

    throw err;
    ^

Error: Cannot find module 'chalk'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (E:\vuejs_demo\vuejs\build\check-versions.js:2:15)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_project@1.0.0 dev: `node build/dev-server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_project@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.


npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2017-11-09T0
9_24_39_812Z-debug.log


E:\vuejs_demo\vuejs>rm -rf node_modules
'rm' 不是内部或外部命令,也不是可运行的程序
或批处理文件。


E:\vuejs_demo\vuejs>cnpm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data e
xtracted from the cache is guaranteed to be valid. If you want to make sure ever
ything 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\Administrator\AppData\Roaming\npm-cache\_logs\2017-11-09T0

9_27_04_076Z-debug.log


解决办法:

1、删除node_modules这个文件夹
2、切换到工程目录
3、清空缓存:cnpm cache clean
4、重新安装(依赖包):cnpm install
5、重新build(js文件):cnpm run build
5、重新运行,cnpm run dev,启动成功


发布了21 篇原创文章 · 获赞 6 · 访问量 8万+
展开阅读全文

运行Vue项目时,报错npm ERR! errno 1 npm ERR! Failed at the single@1.0.0 dev script.

06-16

运行Vue项目时,报错,不清楚是哪里出了问题 ``` Error: Cannot find module 'webpack-cli/bin/config-yargs' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:690:17) at require (internal/modules/cjs/helpers.js:25:18) at Object.<anonymous> (E:\HBuilderProjects\Vue\single\node_modules\_webpack-dev-server@3.7.1@webpack-dev-server\bin\webpack-dev-server.js:60:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! single@1.0.0 dev: `webpack-dev-server --open --hot --port 8020` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the single@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\asus\AppData\Roaming\npm-cache\_logs\2019-06-15T16_43_01_654Z-debug.log ``` ``` ``` 这个是package.json文件 ``` { "name": "single", "version": "1.0.0", "description": "", "main": "main.js", "scripts": { "dev": "webpack-dev-server --open --hot --port 8020" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "vue": "^2.6.10" }, "devDependencies": { "babel-core": "^6.26.3", "babel-loader": "^8.0.6", "babel-preset-env": "^1.7.0", "css-loader": "^3.0.0", "file-loader": "^4.0.0", "vue-html-loader": "^1.2.4", "vue-loader": "^15.7.0", "vue-style-loader": "^4.1.2", "vue-template-compiler": "^2.6.10", "webpack": "^4.34.0", "webpack-dev-server": "^3.7.1" } } ``` 问答

npm run dev 报错求助啊

03-28

C:\Users\lyx\Desktop\eyed\frontend>npm run dev > eyed@1.0.0 dev C:\Users\lyx\Desktop\eyed\frontend > node build/dev-server.js module.js:471 throw err; ^ Error: Cannot find module 'semver' 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:\Users\lyx\Desktop\eyed\frontend\build\check-versions.js:1:76) 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! Windows_NT 10.0.14393 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev" npm ERR! node v6.10.1 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! eyed@1.0.0 dev: `node build/dev-server.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the eyed@1.0.0 dev script 'node build/dev-server.js'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the eyed package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node build/dev-server.js npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs eyed npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls eyed npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! C:\Users\lyx\Desktop\eyed\frontend\npm-debug.log C:\Users\lyx\Desktop\eyed\frontend> 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览