vue 框架 view ui 安装推荐工程
https://github.com/view-design/view-ui-project
一、npm install
二、npm run init
出现问题
$ npm run init > view-ui-project@4.0.0 init C:\web\admin.whmall > webpack --progress --config webpack.dev.config.js 0% compilingfs.js:128 throw new ERR_INVALID_CALLBACK(); ^ TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at maybeCallback (fs.js:128:9) at Object.write (fs.js:540:14) at C:\web\admin.whmall\webpack.dev.config.js:10:8 at FSReqWrap.args [as oncomplete] (fs.js:140:20) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! view-ui-project@4.0.0 init: `webpack --progress --config webpack.dev.config.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the view-ui-project@4.0.0 init 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\Lenovo\AppData\Roaming\npm-cache\_logs\2020-02-26T02_18_26_398Z-debug.log
解决办法,因为npm版本可能过高,1要么降版本,2.修改webpack.dev.config.js
const webpack = require('webpack'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const merge = require('webpack-merge'); const webpackBaseConfig = require('./webpack.base.config.js'); const fs = require('fs'); fs.open('./src/config/env.js', 'w', function (err, fd) { const buf = 'export default "development";'; //fs.write(fd, buf, 0, buf.length, 0, function (err, written, buffer){}); //修改成 fs.write(fd, buf, 0, 'utf-8', function (err, written, buffer){}); }); module.exports = merge(webpackBaseConfig, { devtool: '#source-map', output: { publicPath: '/dist/', filename: '[name].js', chunkFilename: '[name].chunk.js' }, plugins: [ new ExtractTextPlugin({ filename: '[name].css', allChunks: true }), new webpack.optimize.CommonsChunkPlugin({ name: 'vendors', filename: 'vendors.js' }), new HtmlWebpackPlugin({ filename: '../index.html', template: './src/template/index.ejs', inject: false }) ] });
三、npm run dev