laravel-mix: npm run dev failing with error, code ELIFECYCLE

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

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

npm cache clean --force

rm -rf node_modules package-lock.json

npm install

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