iview / iview-project

This project is build for Vue.js 2 + vue-router + webpack2 + iView 3
MIT License
839 stars 389 forks source link

直接clone这个项目,npm install, npm init,然后跑npm run dev报错。 #52

Open TowingTop opened 6 years ago

TowingTop commented 6 years ago

C:\Users\Administrator\Documents\GitHub\iview-project>npm run dev

iview-rookie@1.0.0 dev C:\Users\Administrator\Documents\GitHub\iview-project webpack-dev-server --content-base ./ --open --inline --hot --compress --history-api-fallback --config webpack.dev.config.js

fs.js:157 throw new ERR_INVALID_CALLBACK(); ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function at maybeCallback (fs.js:157:9) at Object.fs.write (fs.js:674:14) at C:\Users\Administrator\Documents\GitHub\iview-project\webpack.dev.config.js:10:8 at FSReqWrap.oncomplete (fs.js:169:20) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! iview-rookie@1.0.0 dev: webpack-dev-server --content-base ./ --open --inline --hot --compress --history-api-fallback --config webpack.dev.config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the iview-rookie@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\Administrator\AppData\Roaming\npm-cache_logs\2018-06-17T20_52_06_477Z-debug.log

ghost commented 6 years ago

我也是!

DayThink commented 6 years ago

node版本的问题: 把const buf = 'export default "development";'; 改为 const buf = Buffer.from('export default "development";'); 详情看下面: MacBook-Pro:iview-project zhengguangguo$ git diff webpack.dev.config.js diff --git a/webpack.dev.config.js b/webpack.dev.config.js index eced4cf..b6b6c50 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -6,7 +6,8 @@ const webpackBaseConfig = require('./webpack.base.config.js'); const fs = require('fs');

fs.open('./src/config/env.js', 'w', function (err, fd) {

@@ -32,4 +33,4 @@ module.exports = merge(webpackBaseConfig, { inject: false }) ] -}); \ No newline at end of file +}); MacBook-Pro:iview-project zhengguangguo$

jiangbai333 commented 6 years ago

@DayThink 有个问题,请您不吝赐教! 遇到这种错误,第一时间是想如何找到出错位置,如何自己解决!但是没法排查出您提供的解决方法!请问您是怎么知道需要这样改的(或者说,怎么通过错误提示,确定了是node版本的问题) 谢谢!

MiniTea commented 5 years ago

我也是卡在这里,issures提供的解决方案都行不通,run dev成功不了