Я получаю сообщение об ошибке при запуске любых скриптов npm, касающихся Webpack и babel. Я только что закончил настраивать и webpack, и babel (или думал, что все сделал правильно). перед установкой и настройкой babel, моя конфигурация webpack работала отлично.
Пожалуйста, это мой первый раз с webpack / babel, поэтому я не знаю, как его решить. Я буду признателен за любую помощь, спасибо.
/home/simi/Desktop/Github Repos/complete-javascript-course/9-forkify/starter/node_modules/webpack-cli/bin/config-yargs.js:89
describe: optionsSchema.definitions.output.properties.path.description,
^
TypeError: Cannot read property 'properties' of undefined
at module.exports (/home/simi/Desktop/Github Repos/complete-javascript-course/9-forkify/starter/node_modules/webpack-cli/bin/config-yargs.js:89:48)
at /home/simi/Desktop/Github Repos/complete-javascript-course/9-forkify/starter/node_modules/webpack-cli/bin/webpack.js:60:27
at Object.<anonymous> (/home/simi/Desktop/Github Repos/complete-javascript-course/9-forkify/starter/node_modules/webpack-cli/bin/webpack.js:515:3)
at Module._compile (internal/modules/cjs/loader.js:1147:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:996:32)
at Function.Module._load (internal/modules/cjs/loader.js:896:14)
at Module.require (internal/modules/cjs/loader.js:1036:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/simi/Desktop/Github Repos/complete-javascript-course/9-forkify/starter/node_modules/webpack/bin/webpack.js:156:2)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! forkify@1.0.0 dev: `webpack --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the forkify@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Мой webpack.config. js файл:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: ['babel-polyfill', './src/js/index.js'],
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'js/bundle.js'
},
devServer: {
contentBase: './dist'
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: './src/index.html'
})
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
}
};
Мой .babelr c файл:
{
"presets": [
[
"env",
{
"targets": {
"browsers": ["last 5 versions", "ie >= 8"]
}
}
]
]
}
... И мой пакет. json файл:
{
"name": "forkify",
"version": "1.0.0",
"description": "forkify project",
"main": "index.js",
"scripts": {
"dev": "webpack --mode development",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"author": "Simeon Udoh",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"html-webpack-plugin": "^3.0.7",
"webpack": "^4.2.0",
"webpack-cli": "^2.0.12",
"webpack-dev-server": "^3.1.1"
},
"dependencies": {
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"fractional": "^1.0.0",
"uniqid": "^4.1.1"
}
}