jujisan
jujisan

Reputation: 39

Why 'npm run watch' gives error in laravel?

I am following this tutorial http://w3programmers.com/bangla/build-an-e-commerce-project-with-laravel-in-bangla-part-6/ . In this tutorial when executing 'npm run watch' in command prompt, an app.js file creates in public/backend/js. But when I execute 'npm run watch' no such file created. After executing 'npm run watch' command I found this in command prompt

> @ watch E:\Laravel\ecommerce-application
> npm run development -- --watch


> @ development E:\Laravel\ecommerce-application
> node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

internal/modules/cjs/loader.js:960
  throw err;
  ^

Error: Cannot find module 'E:\Laravel\ecommerce-application\node_modules\cross-env\dist\bin\cross-env.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
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 WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\J.U.Jisan\AppData\Roaming\npm-cache\_logs\2020-05-09T18_22_08_016Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\J.U.Jisan\AppData\Roaming\npm-cache\_logs\2020-05-09T18_22_08_158Z-debug.log

Upvotes: 1

Views: 1507

Answers (2)

Md. Saiful Islam
Md. Saiful Islam

Reputation: 107

Run these two lines, they were working for me.

   $ npm config rm proxy
   $ npm config rm https-proxy

Then, go for your command.

Upvotes: 3

samir imtiaz
samir imtiaz

Reputation: 49

please run : npm install then npm run watch

Upvotes: 1

Related Questions