npm run dev error windows 10

-2

I have errors with npm run dev, I made a npm rebuild, then a npm install, to try again with npm run dev, and it shows me these errors:

# npm run dev

> [email protected] dev c:\xampp\htdocs\site
> cross-env NODE_ENV=development webpack-dev-server --open --inline --hot

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

Error: Cannot find module 'hard-source-webpack-plugin'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (c:\xampp\htdocs\site\webpack.config.js:3:31)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: 'cross-env NODE_ENV=development webpack-dev-server --open --inline --hot'
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!     C:\Users\Desk\AppData\Roaming\npm-cache\_logs18-07-12T04_14_16_402Z-debug.log

How can I solve it? By google I did not find a solution to repair the error, thanks.

    
asked by Tondrax 12.07.2018 в 07:12
source

1 answer

0

The problem is that you did not find the module 'hard-source-webpack-plugin', check that in your package.json file you have something similar to:

{
  "name": "",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "hard-source-webpack-plugin": "^0.11.1"
  }
 "dependencies": {
    "hard-source-webpack-plugin": "^0.11.1"
  }
}

that 'hard-source-webpack-plugin' appears in some of the two dependency lines (devDependencies or dependencies), if they do not appear, simply in the root of the project (where do you have the package.json) write from the line of commands:     npm install --save hard-source-webpack-plugin

    
answered by 17.07.2018 в 12:57