还是不行
> shizhan-vue@1.0.0 build E:\web前段\shizhan-vue
> webpack --mode development
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli (https://github.com/webpack/webpack-cli)
The original webpack full-featured CLI.
- webpack-command (https://github.com/webpack-contrib/webpack-command)
A lightweight, opinionated webpack CLI.
We will use "npm" to install the CLI via "npm install -D".
Which one do you like to install (webpack-cli/webpack-command):
按照大神的方法出现了这个问题,是什么原因怎么破?我试着安装了webpack-cli后报以下错误
Installing 'webpack-cli' (running 'npm install -D webpack-cli')...
npm WARN shizhan-vue@1.0.0 No description
npm WARN shizhan-vue@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ webpack-cli@3.1.0
added 76 packages in 54.02s
TypeError: path.jion is not a function
at Object.<anonymous> (E:\web前段\shizhan-vue\webpack.config.js:6:12)
at Module._compile (E:\web前段\shizhan-vue\node_modules\v8-compile-cache\v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (E:\web前段\shizhan-vue\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\convert-argv.js:133:13)
at requireConfig (E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\convert-argv.js:135:6)
at E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\convert-argv.js:142:17
at Array.forEach (<anonymous>)
at module.exports (E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\convert-argv.js:140:15)
at yargs.parse (E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\cli.js:241:39)
at Object.parse (E:\web前段\shizhan-vue\node_modules\yargs\yargs.js:563:18)
at E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\cli.js:219:8
at Object.<anonymous> (E:\web前段\shizhan-vue\node_modules\webpack-cli\bin\cli.js:530:3)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at runCommand.then (E:\web前段\shizhan-vue\node_modules\webpack\bin\webpack.js:152:5)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! shizhan-vue@1.0.0 build: `webpack --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the shizhan-vue@1.0.0 build 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\小陆\AppData\Roaming\npm-cache\_logs\2018-08-06T08_48_54_669Z-debug.log
厉害了,问题已经解决
可以,已解决
这个可以,已解决。
是webpack升级到4以后的问题
可以,解决了
1,修改package.json中代码
将老师编辑的
"build": "webpack --config webpack.config.js"
修改为
"build": "webpack --mode development"
2,修改webpack.config.js中代码
顶部添加
const {
VueLoaderPlugin
} = require('vue-loader');
将【module】中新增【css】以及末尾添加【plugins】
修改为:
module: {
rules: [{
test: /.vue$/,
loader: 'vue-loader'
}, {
test: /.css$/,
use: ['vue-style-loader', 'css-loader']
}]
},
plugins: [
new VueLoaderPlugin()
]