Recently I am doing my side project using Hybrid framework Ionic2.
Ionic2 has a CLI tool and the command "ionic serve" can start your local server and watch your local changes.
After some code refactoring, I tried to run "ionic serve" and hoping ionic could start the local server as usual, but the local server failed to run without giving any error info.
[WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.
As of CLI 3.8, it is no longer needed. You can uninstall it:
npm uninstall -D @ionic/cli-plugin-ionic-angular
Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser -
Ctrl+C to cancel
[21:18:22] watch started ...
[21:18:22] build dev started ...
[21:18:22] clean started ...
[21:18:22] clean finished in 14 ms
[21:18:22] copy started ...
[21:18:22] transpile started ...
[21:18:25] transpile finished in 2.98 s
[21:18:25] preprocess started ...
[21:18:25] deeplinks started ...
[21:18:25] deeplinks finished in 88 ms
[21:18:25] preprocess finished in 92 ms
[21:18:25] webpack started ...
[21:18:25] copy finished in 3.31 s
And when I run this command "npm run ionic:serve"
It gave me the following error
> cutePuppyPics@0.0.1 ionic:serve F:\Projects\EazeTrade
> ionic-app-scripts serve
[21:20:10] ionic-app-scripts 1.3.7
[21:20:10] watch started ...
[21:20:10] build dev started ...
[21:20:10] clean started ...
[21:20:10] clean finished in 3 ms
[21:20:10] copy started ...
[21:20:10] transpile started ...
[21:20:13] transpile finished in 2.96 s
[21:20:13] preprocess started ...
[21:20:13] deeplinks started ...
[21:20:13] deeplinks finished in 85 ms
[21:20:13] preprocess finished in 89 ms
[21:20:13] webpack started ...
[21:20:13] copy finished in 3.31 s
TypeError: Data must be a string or a buffer
at TypeError (native)
at Hash.update (crypto.js:74:16)
at HarmonyExportImportedSpecifierDependency.updateHash (F:\Projects\EazeTrade\node_modules\webpack\lib\dependencies\HarmonyExportImportedSpecifierDependency.js:151:8)
at F:\Projects\EazeTrade\node_modules\webpack\lib\DependenciesBlock.js:33:5
at Array.forEach (native)
at NormalModule.DependenciesBlock.updateHash (F:\Projects\EazeTrade\node_modules\webpack\lib\DependenciesBlock.js:32:20)
at NormalModule.Module.updateHash (F:\Projects\EazeTrade\node_modules\webpack\lib\Module.js:162:41)
at NormalModule.updateHash (F:\Projects\EazeTrade\node_modules\webpack\lib\NormalModule.js:327:30)
at modules.forEach.m (F:\Projects\EazeTrade\node_modules\webpack\lib\Chunk.js:253:31)
at Array.forEach (native)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "F:\\NodeJs\\node.exe" "F:\\NodeJs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:serve"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! cutePuppyPics@0.0.1 ionic:serve: `ionic-app-scripts serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cutePuppyPics@0.0.1 ionic:serve script 'ionic-app-scripts serve'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the cutePuppyPics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs cutePuppyPics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls cutePuppyPics
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! F:\Projects\EazeTrade\npm-debug.log
But this does not offer much help about this issue. Finally I found this answer from Github
https://github.com/webpack/webpack/issues/4072
Then I got the error info
File not found: HarmonyImportDependency {
module: null,
request: './customer',
userRequest: './customer',
range: [ 153, 191 ],
importedVar: '__WEBPACK_IMPORTED_MODULE_4__customer__',
loc:
SourceLocation {
start: Position { line: 5, column: 0 },
end: Position { line: 5, column: 38 } } }
crypto.js:74
this._handle.update(data, encoding);
It turns out I forgot import the customer.ts file.