简体   繁体   中英

How can I solve the npm run dev error I'm facing after creating a new Laravel 7 project?

I have created a new Laravel 7 project and after doing so, ran the command npm install and all the packages in my package.json were downloaded into the node_modules directory. Then i tried running the command npm run dev and keeps on failing.

I'm using the following versions

  • PHP 7.4.11
  • Laravel installer 4.11
  • Node v15.0.1
  • npm 7.0.3
  • Composer 2.0.9

This is my package.json file

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
    "autoprefixer": "^10.2.4",
    "axios": "^0.21.1",
    "cross-env": "^7.0.3",
    "laravel-mix": "^5.0.1",
    "lodash": "^4.17.13",
    "resolve-url-loader": "^3.1.0",
    "sass": "^1.15.2",
    "sass-loader": "^8.0.0",
    "webpack": "^5.21.2",
    "webpack-cli": "^4.5.0"
},
"name": "MyProject"
}

This is the error I get after running npm run watch or npm run dev

> dev
> npm run development


> 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! command C:\WINDOWS\system32\cmd.exe /d /s /c "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! A complete log of this run can be found in:
npm ERR!     C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_575Z- 
debug.log
npm ERR! code 2
npm ERR! path C:\Users\Rolling Sure\Desktop\Code Fintech\duplicate\MyProject
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "npm run development"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_652Z- 
debug.log

You could try reinstalling the node packages.

  • Delete the node_modules folder.
  • run npm install again

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