question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm run dev failing with error, code ELIFECYCLE

See original GitHub issue

Install a fresh Laravel 5.5, configured the db and composer update. Then i run the command yarn, it goes well. While i run the command npm run dev it shows an error and build failed.

  • Laravel Mix Version: #.#.# (npm list --depth=0)
├── axios@0.16.2
├── bootstrap-sass@3.3.7
├── cross-env@5.0.5
├── jquery@3.2.1
├── laravel-mix@1.4.3
├── lodash@4.17.4
└── vue@2.4.4

  • Node Version (node -v): v8.5.0
  • NPM Version (npm -v): 5.3.0
  • OS: Ubuntu 16.04

Description:

npm run dev failed with error. Here is the output the error log.

> @ dev /var/www/html/laravel/test-laravel
> npm run development


> @ development /var/www/html/laravel/test-laravel
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

 95% emitting                                                                         

 ERROR  Failed to compile with 1 errors                                                                                                                                            15:42:00

 error  in ./resources/assets/js/components/Example.vue

Module build failed: Error: Cannot find module './lib/beautify'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at /var/www/html/laravel/test-laravel/node_modules/js-beautify/js/index.js:74:27
    at Object.<anonymous> (/var/www/html/laravel/test-laravel/node_modules/js-beautify/js/index.js:80:7)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/www/html/laravel/test-laravel/node_modules/vue-loader/lib/template-compiler/index.js:4:16)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at loadLoader (/var/www/html/laravel/test-laravel/node_modules/loader-runner/lib/loadLoader.js:13:17)
    at iteratePitchingLoaders (/var/www/html/laravel/test-laravel/node_modules/loader-runner/lib/LoaderRunner.js:169:2)
    at runLoaders (/var/www/html/laravel/test-laravel/node_modules/loader-runner/lib/LoaderRunner.js:362:2)
    at NormalModule.doBuild (/var/www/html/laravel/test-laravel/node_modules/webpack/lib/NormalModule.js:182:3)
    at NormalModule.build (/var/www/html/laravel/test-laravel/node_modules/webpack/lib/NormalModule.js:275:15)
    at Compilation.buildModule (/var/www/html/laravel/test-laravel/node_modules/webpack/lib/Compilation.js:149:10)
    at factoryCallback (/var/www/html/laravel/test-laravel/node_modules/webpack/lib/Compilation.js:337:12)
    at factory (/var/www/html/laravel/test-laravel/node_modules/webpack/lib/NormalModuleFactory.js:241:5)
    at applyPluginsAsyncWaterfall (/var/www/html/laravel/test-laravel/node_modules/webpack/lib/NormalModuleFactory.js:94:13)

 @ ./resources/assets/js/components/Example.vue 6:2-212
 @ ./resources/assets/js/app.js
 @ multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss

                                                                                                    Asset     Size  Chunks                    Chunk Names
  fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.eot?f4769f9bdb7466be65088239c12046d1  20.1 kB          [emitted]         
fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff2?448c34a56d699c29117adc64c43affeb    18 kB          [emitted]         
 fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.woff?fa2772327f55d8198301fdb8bcfc8158  23.4 kB          [emitted]         
  fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.ttf?e18bbf611f2a2e43afc071aa2f4e1512  45.4 kB          [emitted]         
  fonts/vendor/bootstrap-sass/bootstrap/glyphicons-halflings-regular.svg?89889688147bd7575d6327160d64e760   109 kB          [emitted]         
                                                                                               /js/app.js  1.21 MB       0  [emitted]  [big]  /js/app
                                                                                             /css/app.css   147 kB       0  [emitted]         /js/app
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ development 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!     /home/nasirkhan/.npm/_logs/2017-09-18T09_42_00_813Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the @ 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!     /home/nasirkhan/.npm/_logs/2017-09-18T09_42_00_939Z-debug.log

Error log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
2 info using npm@5.3.0
3 info using node@v8.5.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
8 verbose lifecycle @~dev: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/var/www/html/laravel/test-laravel/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/nasirkhan/Android/Sdk/platform-tools:/home/nasirkhan/Android/Sdk/tools
9 verbose lifecycle @~dev: CWD: /var/www/html/laravel/test-laravel
10 silly lifecycle @~dev: Args: [ '-c', 'npm run development' ]
11 silly lifecycle @~dev: Returned: code: 2  signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid @
15 verbose cwd /var/www/html/laravel/test-laravel
16 verbose Linux 4.4.0-93-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
18 verbose node v8.5.0
19 verbose npm  v5.3.0
20 error code ELIFECYCLE
21 error errno 2
22 error @ dev: `npm run development`
22 error Exit status 2
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Steps To Reproduce:


composer create-project --prefer-dist laravel/laravel blog

yarn

npm run dev

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
SHIVAMGUPTA24commented, Apr 8, 2020

npm cache clean --force

rm -rf node_modules package-lock.json

npm install

1reaction
qm3stercommented, Sep 18, 2017

Time to remove "js-beautify": "1.6.14" from your "dependencies":{} and "resolve":{} vue-loader@13.0.5 has been published, please update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm run dev issue (npm ERR! code ELIFECYCLE) - scmGalaxy
Error:- ; Solution:- ; Step 1:- Run this command to verify cache ; Step 2:- Recheck your package.json and webpack.mix.js file it is...
Read more >
How to fix the npm ERR! code ELIFECYCLE error - Reactgo
First, clean the npm cache by using the following command. · Delete the node_modules folder and package-lock. · Now, re-install the npm packages ......
Read more >
How to solve npm error "npm ERR! code ELIFECYCLE"
I was getting this npm ERR! code ELIFECYCLE error while running a build. Clearing the cache and removing the package-lock.json files did not...
Read more >
How to solve npm error npm ERR! code ELIFECYCLE
In order to solve the “npm ERR! code ELIFECYCLE ” error which is a very common type of error that occurs during npm...
Read more >
npm ERR! code ELIFECYCLE - DEV Community ‍ ‍
The "ELIFECYCLE" error occurs when an unknown error causes the application to fail. Probably another software was running and conflicted ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found