简体   繁体   中英

Error while compiling with Laravel Mix - Vue



I've been using Laravel 8 beside Vue Js and they worked well together. I tried to start a project with Laravel and Vue Js again, but after a week it gave me an error. I used the commands below:
Laravel v8.26.1 (PHP v7.4.3)

composer create-project --prefer-dist laravel/laravel <project_name>

It works fine, after that:

npm install

Works well, too

But here's the error when I try running npm run dev

 npm run dev > @ dev <project_path> > npm run development > @ development <project_path> > mix Error: You are using an unspported version of Node. Please update to at least Node v12.14 at assertSupportedNodeVersion (<project_path>/node_modules/laravel-mix/src/Engine.js:6:15) at executeScript (<project_path>/node_modules/laravel-mix/bin/cli.js:58:5) at Command.program.command.description.option.action.cmd (<project_path>/node_modules/laravel-mix/bin/cli.js:44:13) at Command.listener [as _actionHandler] (<project_path>/node_modules/commander/index.js:426:31) at Command._parseCommand (<project_path>/node_modules/commander/index.js:1002:14) at Command._dispatchSubcommand (<project_path>/node_modules/commander/index.js:953:18) at Command._parseCommand (<project_path>/node_modules/commander/index.js:979:12) at Command.parse <project_path>/node_modules/commander/index.js:801:10) at Command.parseAsync (<project_path>/node_modules/commander/index.js:828:10) at run (<project_path>/node_modules/laravel-mix/bin/cli.js:47:19) npm ERR: code ELIFECYCLE npm ERR. errno 1 npm ERR. @ development. `mix` npm ERR: Exit status 1 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/user/.npm/_logs/2021-02-06T07_19_07_707Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: `npm run development` npm ERR! Exit status 1 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/user/.npm/_logs/2021-02-06T07_19_07_767Z-debug.log

package.json

 { "private": true, "scripts": { "dev": "npm run development", "development": "mix", "watch": "mix watch", "watch-poll": "mix watch -- --watch-options-poll=1000", "hot": "mix watch --hot", "prod": "npm run production", "production": "mix --production" }, "devDependencies": { "axios": "^0.21", "bootstrap": "^4.0.0", "cross-env": "^5.1", "jquery": "^3.2", "laravel-mix": "^6.0.6", "lodash": "^4.17.19", "popper.js": "^1.12", "resolve-url-loader": "^2.3.1", "sass": "^1.20.1", "sass-loader": "^8.0.0", "vue": "^2.5.17", "vue-router": "^3.4.9", "vue-template-compiler": "^2.6.10" }, "dependencies": [] }

I didn't do something special or configure anything!
Thanks in advance;D

You have to upgrade your node so try these commands:

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

check node version by:

sudo node -v

it must show something like v14.*

You may need to restart your terminal to see the updated node version.

And then do npm run dev

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM