1

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
kgori_dev
  • 154
  • 2
  • 18
  • Does this answer your question? [In laravel npm run dev errors:](https://stackoverflow.com/questions/50020636/in-laravel-npm-run-dev-errors) –  Feb 15 '21 at 10:01
  • @Rohit it doesn't, because i already attempted that and still getting the same error – kgori_dev Feb 15 '21 at 10:05
  • A log of the error npm is encountering is in that error message. Open `C:\Users\Rolling Sure\AppData\Local\npm-cache\_logs\2021-02-15T09_26_50_575Z- debug.log` and look there. If you have trouble figuring it out, post back with what the log file says. – villecoder Feb 15 '21 at 17:24

1 Answers1

1

You could try reinstalling the node packages.

  • Delete the node_modules folder.
  • run npm install again
javier_domenech
  • 5,995
  • 6
  • 37
  • 59