为了账号安全,请及时绑定邮箱和手机立即绑定

cnpm run dev出错!

cnpm run dev出错!

慕圣9424722 2017-09-19 23:39:31
跟着教程一步步来的~ 出现下面的错误$ cnpm run devnpm ERR! path C:\Users\acer\mall\package.jsonnpm ERR! code ENOENTnpm ERR! errno -4058npm ERR! syscall opennpm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\acer\mall\package.json'npm ERR! enoent This is related to npm not being able to find a file.npm ERR! enoentnpm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\acer\AppData\Roaming\npm-cache\_logs\2017-09-19T15_35_23_077Z-debug.log
查看完整描述

4 回答

已采纳
?
菜鸟教程

TA贡献25条经验 获得超33个赞

检查你项目目录底下的package.json,npm run dev 的配置在script里面。

查看完整回答
2 反对 回复 2017-09-20
?
慕圣9424722

TA贡献1条经验 获得超0个赞

确实是搞错目录了,重新在安装后再run就成功了..但是我ctrl c后重新cnpm run dev,又报错...



$ cnpm run dev


> mymall@1.0.0 dev C:\Users\acer\mall\mymall

> node build/dev-server.js


npm WARN invalid config loglevel="notice"

> Starting dev server...

events.js:160

      throw er; // Unhandled 'error' event

      ^


Error: listen EADDRINUSE :::8080

    at Object.exports._errnoException (util.js:1020:11)

    at exports._exceptionWithHostPort (util.js:1043:20)

    at Server._listen2 (net.js:1258:14)

    at listen (net.js:1294:10)

    at Server.listen (net.js:1390:5)

    at EventEmitter.listen (C:\Users\acer\mall\mymall\node_modules\_express@4.15.4@express\lib\application.js:618:24)

    at Object.<anonymous> (C:\Users\acer\mall\mymall\build\dev-server.js:83:18)

    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)

    at Module.runMain (module.js:604:10)

    at run (bootstrap_node.js:389:7)

    at startup (bootstrap_node.js:149:9)

    at bootstrap_node.js:502:3

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! mymall@1.0.0 dev: `node build/dev-server.js`

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the mymall@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\acer\AppData\Roaming\npm-cache\_logs\2017-09-19T16_03_31_299Z-debug.log



这个Error: listen EADDRINUSE :::8080,应该是端口被之前那个给占用了~ 这下咋办


查看完整回答
反对 回复 2017-09-20
  • 菜鸟教程
    菜鸟教程
    找到build文件夹中的dev-server.js 可以修改端口。假如你的目录是和vue-cil差不多的,有一个config文件夹的,可以直接在config/index.js 里面修改port
  • 从从果果
    从从果果
    任务管理器-结束nodejs
  • 4 回答
  • 0 关注
  • 8785 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信