npm run dev 出错的解决办法

Posted Cristina_Guan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm run dev 出错的解决办法相关的知识,希望对你有一定的参考价值。

bogon:~ yan$ cd my-project

bogon:my-project yan$ npm run dev

 

> [email protected] dev /Users/yan/my-project

> node build/dev-server.js

 

module.js:471

    throw err;

    ^

 

Error: Cannot find module ‘shelljs‘

    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> (/Users/yan/my-project/build/check-versions.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)

ERR! code ELIFECYCLE

errno 1

ERR! [email protected] dev: `node build/dev-server.js`

ERR! Exit status 1

 

ERR! Failed at the [email protected] dev script.

ERR! This is probably not a problem with npm. There is likely additional logging output above.

 

ERR! A complete log of this run can be found in:

ERR!     /Users/yan/.npm/_logs/2017-09-13T09_56_03_996Z-debug.log

bogon:my-project yan$ npm install shelljs

notice created a lockfile as package-lock.json. You should commit this file.

+ [email protected]

added 16 packages in 32.151s

 

解决办法:error提示缺少什么模块就 npm install XXX ,缺少什么模块就运行安装命令;

 

bogon:my-project yan$ npm run dev

 

> [email protected] dev /Users/yan/my-project

> node build/dev-server.js

 > Starting dev server...

直到启动dev成功;

以上是关于npm run dev 出错的解决办法的主要内容,如果未能解决你的问题,请参考以下文章

Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法

npm安装模块依赖时一个常见的报错的解决办法(“Please try running this command again as root/Administrator”)

npm dev run 报错

npm run dev 报错:missing script:dev

Laravel 框架在 Mac 上使用命令 npm run dev 时报错问题

vue项目npm run dev报错events.js:160 throw er; // Unhandled 'error' event listen EADDRINUSE