Open Evanzhao08 opened 6 years ago
我运行也是报错:
> iview-project@3.0.0 init /Users/usr/Downloads/iview-project-3.0
> webpack --progress --config webpack.dev.config.js
0% compilingfs.js:133
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at maybeCallback (fs.js:133:9)
at Object.write (fs.js:540:14)
at /Users/minho/Downloads/iview-project-3.0/webpack.dev.config.js:10:8
at FSReqWrap.oncomplete (fs.js:145:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! iview-project@3.0.0 init: `webpack --progress --config webpack.dev.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the iview-project@3.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:
将 webpack.dev.config.js / webpack.prod.config.js 中的
const buf = 'export default "development";';
替换为
const buf = Buffer.from('export default "development";');
In your "webpack.dev.config.js"
replace
fs.write(fd, buf, 0, buf.length, 0, function (err, written, buffer){});
with
fs.write(fd, buf, function(err, written, buffer) {});
same goes to production webpack config
@tweikiang really help me!
0 info it worked if it ends with ok 1 verbose cli [ 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'init' ] 2 info using npm@6.1.0 3 info using node@v10.5.0 4 verbose run-script [ 'preinit', 'init', 'postinit' ] 5 info lifecycle iview-project@2.1.0~preinit: iview-project@2.1.0 6 info lifecycle iview-project@2.1.0~init: iview-project@2.1.0 7 verbose lifecycle iview-project@2.1.0~init: unsafe-perm in lifecycle true 8 verbose lifecycle iview-project@2.1.0~init: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\Code\iview-project-2.0\node_modules.bin;D:\Tool\cmder_mini\bin;D:\Tool\cmder_mini\vendor\conemu-maximus5\ConEmu\Scripts;D:\Tool\cmder_mini\vendor\conemu-maximus5;D:\Tool\cmder_mini\vendor\conemu-maximus5\ConEmu;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Users\Administrator\AppData\Roaming\npm;C:\Program Files\nodejs;D:\Tool\cmder_mini 9 verbose lifecycle iview-project@2.1.0~init: CWD: D:\Code\iview-project-2.0 10 silly lifecycle iview-project@2.1.0~init: Args: [ '/d /s /c', 10 silly lifecycle 'webpack --progress --config webpack.dev.config.js' ] 11 silly lifecycle iview-project@2.1.0~init: Returned: code: 1 signal: null 12 info lifecycle iview-project@2.1.0~init: Failed to exec init script 13 verbose stack Error: iview-project@2.1.0 init: (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:961:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
14 verbose pkgid iview-project@2.1.0
15 verbose cwd D:\Code\iview-project-2.0
16 verbose Windows_NT 6.1.7601
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "init"
18 verbose node v10.5.0
19 verbose npm v6.1.0
20 error code ELIFECYCLE
21 error errno 1
22 error iview-project@2.1.0 init:
webpack --progress --config webpack.dev.config.js
13 verbose stack Exit status 1 13 verbose stack at EventEmitter.webpack --progress --config webpack.dev.config.js
22 error Exit status 1 23 error Failed at the iview-project@2.1.0 init script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]