Q
Q
Quintis2019-09-20 08:42:03
JavaScript
Quintis, 2019-09-20 08:42:03

Can't run webpack script via npm, can anyone help?

C:\Users\Мiша\Desktop\starter>npm run dev

> [email protected] dev C:\Users\Мiша\Desktop\starter
> webpack

Invalid configuration object. Webpack has been initialised using a configuration
 object that does not match the API schema.
 - configuration.output has an unknown property 'fileName'. These properties are
 valid:
   object { auxiliaryComment?, chunkCallbackName?, chunkFilename?, chunkLoadTime
out?, crossOriginLoading?, devtoolFallbackModuleFilenameTemplate?, devtoolLineTo
Line?, devtoolModuleFilenameTemplate?, devtoolNamespace?, filename?, futureEmitA
ssets?, globalObject?, hashDigest?, hashDigestLength?, hashFunction?, hashSalt?,
 hotUpdateChunkFilename?, hotUpdateFunction?, hotUpdateMainFilename?, jsonpFunct
ion?, jsonpScriptType?, library?, libraryExport?, libraryTarget?, path?, pathinf
o?, publicPath?, sourceMapFilename?, sourcePrefix?, strictModuleExceptionHandlin
g?, umdNamedDefine?, webassemblyModuleFilename? }
   -> Options affecting the output of the compilation. `output` options tell web
pack how to write the compiled files to disk.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack`
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 log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Мiша\AppData\Roaming\npm-cache\_logs\2019-09-19T13_20_44_7
30Z-debug.log

C:\Users\Мiша\Desktop\starter>

package.json
{
  "name": "forkify-project",
  "version": "1.0.0",
  "description": "pizza-project",
  "main": "index.js",
  "scripts": {
    "dev": "webpack"
  },
  "author": "Mikeliy",
  "license": "ISC",
  "devDependencies": {
    "webpack": "^4.40.2",
    "webpack-cli": "^3.3.9"
  },
  "dependencies": {}
}

webpack config:
const path = require('path');


module.exports = {
    entry: './src/js/index.js',
    output: {
        path: path.resolve(__dirname ,'dis'),
        fileName: 'bundle.js'
    },
    mode: 'development',

};

error log :
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Мiша\Desktop\starter\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\;;D:\Microsoft VS Code\bin;C:\Users\Мiша\AppData\Roaming\npm
9 verbose lifecycle [email protected]~dev: CWD: C:\Users\Мiша\Desktop\starter
10 silly lifecycle [email protected]~dev: Args: [ '/d /s /c', 'webpack' ]
11 silly lifecycle [email protected]~dev: Returned: code: 1  signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `webpack`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:198:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:198:13)
13 verbose stack     at maybeClose (internal/child_process.js:982:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Мiша\Desktop\starter
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v10.16.3
19 verbose npm  v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `webpack`
22 error Exit status 1
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yasuro, 2019-09-20
@Yasuro

I myself suffered for a long time with WebPack, in the end I could only launch it like this: https://youtu.be/DTF8op91Aes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question