- Laravel — npm run dev error
- Laravel 8 Installation — npm run dev Error
- 5 Answers 5
- Not the answer you’re looking for? Browse other questions tagged laravel npm or ask your own question.
- Linked
- Related
- Hot Network Questions
- Subscribe to RSS
- In laravel npm run dev errors:
- 3 Answers 3
- npm run dev cross-env error #805
- Comments
- kamrava commented May 13, 2017
- kamrava commented May 13, 2017 •
- vigneshnallamad commented May 16, 2017 •
Laravel — npm run dev error
У меня есть такая проблема:
я как всегда пишу в терминал composer create-project laravel/laravel project: и у меня создаеться проект laravel ‘project’, после этого я в директории проекта пишу:
composer require laravel/ui
php artisan ui vue —auth
и после выполнения последней команды вот такое:
/LaravelPrj$ npm run dev
@ dev /home/alex/LaravelPrj npm run development
@ development /home/alex/LaravelPrj mix
[webpack-cli] /home/alex/LaravelPrj/node_modules/laravel-mix/src/Mix.js:18 static _primary = null; ^
SyntaxError: Unexpected token = at new Script (vm.js:83:7) at NativeCompileCache._moduleCompile (/home/alex/LaravelPrj/node_modules/v8-compile-cache/v8-compile-cache.js:240:18) at Module._compile (/home/alex/LaravelPrj/node_modules/v8-compile-cache/v8-compile-cache.js:184:36) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789: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) at Module.require (internal/modules/cjs/loader.js:692:17) at require (/home/alex/LaravelPrj/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at module.exports (/home/alex/LaravelPrj/node_modules/laravel-mix/setup/webpack.config.js:2:17) npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! @ development: mix 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/alex/.npm/_logs/2021-01-25T11_30_29_373Z-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/alex/.npm/_logs/2021-01-25T11_30_29_388Z-debug.log
это также не помогает:
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear —force
/laravel/blog$ cat /home/alex/.npm/_logs/2021-01-25T12_06_50_464Z-debug.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@6.14.4
3 info using node@v10.19.0
4 verbose run-script [ ‘predev’, ‘dev’, ‘postdev’ ]
5 info lifecycle @
6 info lifecycle @
7 verbose lifecycle @
dev: unsafe-perm in lifecycle true
8 verbose lifecycle @
dev: PATH: /usr/share/npm/node_modules/npm-lifecycle /node-gyp-bin:/home/alex/laravel/blog/node_modules/.bin:/usr/local/sbin: /usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle @
dev: CWD: /home/alex/laravel/blog
10 silly lifecycle @
dev: Args: [ ‘-c’, ‘npm run development’ ]
11 silly lifecycle @
dev: Returned: code: 1 signal: null
12 info lifecycle @
dev: Failed to exec dev script
13 verbose stack Error: @ dev: npm run development
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/share /npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/share /npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid @
15 verbose cwd /home/alex/laravel/blog
16 verbose Linux 5.4.0-64-generic
17 verbose argv «/usr/bin/node» «/usr/bin/npm» «run» «dev»
18 verbose node v10.19.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error @ dev: npm run development
22 error Exit status 1
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
Источник
Laravel 8 Installation — npm run dev Error
5 Answers 5
To fix this issue you need to replace this code.
With the following code in the webpack.mix.js file which you can find in the Laravel app root directory.
try to change the script in package.json
Had the same problem, just removed node and installed it again successfully:
it help me to solved this problem, btw im using laravel 8
I found the same problem before and try this :
- Delete node_modules folder and package-lock.json
- reinstall package using npm install
- Try run npm run dev again.
Not the answer you’re looking for? Browse other questions tagged laravel npm or ask your own question.
Linked
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.15.40479
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
In laravel npm run dev errors:
I have next errors output running npm command for my laravel 5.6 with bootstrap project:
File /home/serge/.npm/_logs/2018-04-25T10_54_37_776Z-debug.log has:
Can you give a hint what could raize an error and how to fix it ?
Some error in config files or what?
Thank you very much!
3 Answers 3
You need to install the cross-env npm package.
It’s listed in your dev dependencies, make sure to run npm install first.
In my case I had to upgrade node to version 14.
Check your node version using
And then, install a stable version from NODESOURCE
Followed by the command as per your needs. In my case:
In case you still face issues, try NPM ERROR
Just listing other keywords of this error:
laravel npm ERR! code ELIFECYCLE laravel
error code ELIFECYCLE
npm ERR! Failed at the @ development script ERR! code EACCES
ERR! code ELIFECYCLE
ERR! code EMISSINGARG
Even when i used the same latest version of npm as was using before, got the above errors on executing npm run dev command. Details of part of the error is «npm ERR! @ development: mix laravel npm ERR! code ELIFECYCLE laravel error code ELIFECYCLE mix not recognised as internal command npm ERR! Failed at the @ development script ERR! code EACCESerrors»
Solution that worked for me : I had unstalled npm which was installed globally and reinstalled the same globally and «npm run dev» worked perfectly. Thanks for highlighting that the problem is associated with npm or incompatible versions of npm.
Источник
npm run dev cross-env error #805
Comments
kamrava commented May 13, 2017
Laravel 5.4.23
Node.js version: 7.7.2
npm version: 4.1.2
LaraDock on Ubuntu 16.04
laradock@10e308159f66:/var/www$ npm run dev
Here is the error:
And Here is package.json :
The text was updated successfully, but these errors were encountered:
kamrava commented May 13, 2017 •
Problem solved after I removed:
vigneshnallamad commented May 16, 2017 •
I’m facing the exact same issue but removing public/mix-manifest.json didn’t fix it.. Here is my log.
Laravel 5.4.22
Node.js version: 7.1.0
npm version: 4.2.0
no homestead or laradock
0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’,
1 verbose cli ‘/usr/local/bin/npm’,
1 verbose cli ‘run’,
1 verbose cli ‘development’ ]
2 info using npm@4.2.0
3 info using node@v7.10.0
4 verbose run-script [ ‘predevelopment’, ‘development’, ‘postdevelopment’ ]
5 info lifecycle @
predevelopment: @
6 silly lifecycle @
predevelopment: no script for predevelopment, continuing
7 info lifecycle @
development: @
8 verbose lifecycle @
development: unsafe-perm in lifecycle true
9 verbose lifecycle @
development: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/vignesh/workspace/appointment/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
10 verbose lifecycle @
development: CWD: /home/vignesh/workspace/appointment
11 silly lifecycle @
development: Args: [ ‘-c’,
11 silly lifecycle ‘cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js —progress —hide-modules —config=node_modules/laravel-mix/setup/webpack.config.js’ ]
12 silly lifecycle @
development: Returned: code: 2 signal: null
13 info lifecycle @
development: Failed to exec development script
14 verbose stack Error: @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js —progress —hide-modules —config=node_modules/laravel-mix/setup/webpack.config.js
14 verbose stack Exit status 2
14 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:194:7)
14 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:194:7)
14 verbose stack at maybeClose (internal/child_process.js:899:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid @
16 verbose cwd /home/vignesh/workspace/appointment
17 error Linux 3.19.0-32-generic
18 error argv «/usr/local/bin/node» «/usr/local/bin/npm» «run» «development»
19 error node v7.10.0
20 error npm v4.2.0
21 error code ELIFECYCLE
22 error errno 2
23 error @ development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js —progress —hide-modules —config=node_modules/laravel-mix/setup/webpack.config.js
23 error Exit status 2
24 error Failed at the @ development script ‘cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js —progress —hide-modules —config=node_modules/laravel-mix/setup/webpack.config.js’.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js —progress —hide-modules —config=node_modules/laravel-mix/setup/webpack.config.js
24 error You can get information on how to open an issue for this project with:
24 error npm bugs
24 error Or if that isn’t available, you can get their info via:
24 error npm owner ls
24 error There is likely additional logging output above.
25 verbose exit [ 2, true ]
UPDATE :
Fixed issue by running npm install —global cross-env
Источник