Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
yandw opened this issue May 29, 2018 · 3 comments
Open

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

yandw opened this issue May 29, 2018 · 3 comments

Comments

@yandw
Copy link

yandw commented May 29, 2018

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

@BnuzLeo
Copy link

BnuzLeo commented Jun 5, 2018

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

@shanxiage
Copy link

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

@BnuzLeo
Copy link

BnuzLeo commented Jun 6, 2018

@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) {});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants