无法 运行 开发
Unable to run dev
我目前正在上 Udemy 的课程,但我被卡住了,我有一个问题 运行ning 脚本。当我 运行 命令 npm 运行 dev 时,我收到此错误消息:
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! forkify@1.0.0 dev: `webpack`
npm ERR! Exit status 2
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs20-05-01T10_10_11_136Z-debug.log
有什么问题吗?这是我的 package.json 代码:
{
"name": "forkify",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"author": "Marv",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"babel-polyfill": "^6.26.0"
}
}
这里是 webpack.config.js 代码:
const path = require('path');
module.exports = {
entry: './src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: 'bundle.js'
},
mode: 'development'
};
有什么问题吗?
更新:我终于可以通过某种方式 npm run dev
但它是在错误的目录中创建的。我该如何解决这个问题?
我需要它显示在 starter > dist > js
下方
你的路径不好用entry: './started/src/js/index.js'
替换entry: './src/js/index.js'
我目前正在上 Udemy 的课程,但我被卡住了,我有一个问题 运行ning 脚本。当我 运行 命令 npm 运行 dev 时,我收到此错误消息:
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! forkify@1.0.0 dev: `webpack`
npm ERR! Exit status 2
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.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs20-05-01T10_10_11_136Z-debug.log
有什么问题吗?这是我的 package.json 代码:
{
"name": "forkify",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"author": "Marv",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"babel-polyfill": "^6.26.0"
}
}
这里是 webpack.config.js 代码:
const path = require('path');
module.exports = {
entry: './src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: 'bundle.js'
},
mode: 'development'
};
有什么问题吗?
更新:我终于可以通过某种方式 npm run dev
但它是在错误的目录中创建的。我该如何解决这个问题?
我需要它显示在 starter > dist > js
你的路径不好用entry: './started/src/js/index.js'
entry: './src/js/index.js'