iview-cli icon indicating copy to clipboard operation
iview-cli copied to clipboard

npm run dev 报错,不太懂webpack,请大神帮忙解决。

Open yandw opened this issue 7 years ago • 3 comments

npm run dev

@1.0.0 dev /Users/atom/Workspace/iview 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 /Users/atom/Workspace/iview/webpack.dev.config.js:10:8 at FSReqWrap.oncomplete (fs.js:169:20) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @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 @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! /Users/atom/.npm/_logs/2018-05-29T01_29_12_570Z-debug.log

yandw avatar May 29 '18 01:05 yandw

遇到一样的问题,有没有解决的方法?

BnuzLeo avatar Jun 05 '18 16:06 BnuzLeo

参考这个才对!https://github.com/iview/iview-admin/pull/649/files

shanxiage avatar Jun 06 '18 01:06 shanxiage

@shanxiage 谢谢, 我试了这样也可以。 把webpackdev.dev.config.js里面改成:

fs.open('./src/config/env.js', 'w', function(err, fd) { const buf = 'export default "development";'; fs.write(fd, buf, 0, buf.length, function(err, written, buffer) {}); });

BnuzLeo avatar Jun 06 '18 14:06 BnuzLeo