慕粉1030219053
2018-09-18 15:48
使用npm run build时,出现下面的问题。检查代码,应该是没有写错的。怎么解决呢?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue_ssr_tech@1.0.0 build: `webpack --config webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue_ssr_tech@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! /Users/mymac/.npm/_logs/2018-09-18T07_41_36_761Z-debug.log
我按照教学视频配置的代码如下:




const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
entry: path.join(__dirname,'src/index.js'),
output: {
filename: "bundle.js",
path: path.join(__dirname,'dist')
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(gif|jpg|jpeg|png|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 1024,
name: '[name].[ext]'
}
}
]
}
]
},
plugins: [
new VueLoaderPlugin()
]
}
这个可能是你有在webpack.config.js中加入plugins(我多装了style-loader url-loader file-loader)
const path = require('path')
module.exports = {
entry: path.join(__dirname,'src/index.js'),
output: {
filename: "bundle.js",
path: path.join(__dirname,'dist')
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.(gif|jpg|jpeg|png|svg)$/,
use: [
{
loader: 'url-loader',
options: {
limit: 1024,
name: '[name].[ext]'
}
}
]
}
]
},
}
这个是新版本的webpack有更改过的缘故,只要把<style></style>中间的样式注释掉就不会报错,应该是少了一个关于style的插件,但具体是什么我暂时也不知道
Vue+Webpack打造todo应用
84617 学习 · 812 问题
相似问题