Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se

Solucionado (ver solução)

Error: 'output.filename' is required, either in config file or as --output-filename at processOptions

Bom dia, estou com esse problema e não estou conseguindo executar o comando, segui o passo a passo da aula porém não cheguei na solução

PS D:\CursoAlura\projeto-webpack\client> npm run build-prod

> client@1.0.0 build-prod D:\CursoAlura\projeto-webpack\client
> cross-env NODE_ENV=production webpack --config webpack.config.js

D:\CursoAlura\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:487
                                throw new Error("'output.filename' is required, either in config file or as --output-filename");
                                ^

Error: 'output.filename' is required, either in config file or as --output-filename
    at processOptions (D:\CursoAlura\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:487:11)
    at processConfiguredOptions (D:\CursoAlura\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:136:4)
    at module.exports (D:\CursoAlura\projeto-webpack\client\node_modules\webpack\bin\convert-argv.js:112:10)
    at Object.<anonymous> (D:\CursoAlura\projeto-webpack\client\node_modules\webpack\bin\webpack.js:155:40)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@1.0.0 build-prod: `cross-env NODE_ENV=production webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 build-prod 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\Eder Tonello\AppData\Roaming\npm-cache\_logs\2019-07-03T14_54_43_125Z-debug.log
PS D:\CursoAlura\projeto-webpack\client> npm run build-prod

> client@1.0.0 build-prod D:\CursoAlura\projeto-webpack\client
> cross-env NODE_ENV=production webpack --config webpack.config.js

D:\CursoAlura\projeto-webpack\client\webpack.config.js:48
                np})
                ^^

SyntaxError: Unexpected identifier
    at new Script (vm.js:80:7)
    at createScript (vm.js:274:10)
    at Object.runInThisContext (vm.js:326:10)
    at Module._compile (internal/modules/cjs/loader.js:664:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client@1.0.0 build-prod: `cross-env NODE_ENV=production webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client@1.0.0 build-prod 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\Eder Tonello\AppData\Roaming\npm-cache\_logs\2019-07-03T14_57_59_630Z-debug.log
2 respostas

Meu arquivo package.json

{
  "name": "client",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build-dev": "webpack --config webpack.config.js",
    "build-prod": "cross-env NODE_ENV=production webpack --config webpack.config.js",
    "start": "webpack-dev-server"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bootstrap": "^3.3.7",
    "reflect-metadata": "^0.1.10"
  },
  "devDependencies": {
    "babel-core": "^6.25.0",
    "babel-loader": "^7.1.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2017": "^6.24.1",
    "babili-webpack-plugin": "^0.1.1",
    "cross-env": "^5.0.1",
    "css-loader": "^0.28.4",
    "cssnano": "^3.10.0",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^0.11.2",
    "optimize-css-assets-webpack-plugin": "^2.0.0",
    "style-loader": "^0.18.2",
    "url-loader": "^0.5.9",
    "webpack": "^3.1.0",
    "webpack-dev-server": "^2.5.1"
  }
}
solução

meu problema era no arquivo webpack.config.js, na tag:

{ 
                test: /\.css$/,
                use: extractTextPlugin.extract({
                    fallback: 'style-loader',
                    use: 'css-loader'
                })
           np },

apenas removi o np