Ionic serve not working with ionic

Hello, guys!
Recently, i optimized ionic app ( like imageOptim , remove unnecessary page )
But I can’t start a local dev server for app dev/testing with ionic serve command.
its stopped after return ‘copy finished’ output

Bellow some utils information about my Ionic project

# ionic info
cli packages: (/Users/mac/Documents/agorna_phone/node_modules)
    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2
global packages:
    Cordova CLI : 7.0.1
local packages:
    @ionic/app-scripts : 1.3.6
    Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.3.1 windows 4.4.3
    Ionic Framework    : ionic-angular 3.6.1
System:
    Node  : v6.11.2
    npm   : 3.10.10
    OS    : macOS Sierra
    Xcode : Xcode 8.2 Build version 8C38
npm run ionic:serve
> agorna@0.0.1 ionic:serve /Users/mac/Documents/agorna_phone
> ionic-app-scripts serve

[12:53:50]  ionic-app-scripts 1.3.6
[12:53:50]  watch started ...
[12:53:50]  build dev started ...
[12:53:50]  clean started ...
[12:53:50]  clean finished in 1 ms
[12:53:50]  copy started ...
[12:53:50]  transpile started ...
[12:53:54]  transpile finished in 4.06 s
[12:53:54]  preprocess started ...
[12:53:54]  deeplinks started ...
[12:53:54]  deeplinks finished in 19 ms
[12:53:54]  preprocess finished in 21 ms
[12:53:54]  webpack started ...
[12:53:54]  copy finished in 4.34 s
crypto.js:74
  this._handle.update(data, encoding);
               ^

TypeError: Data must be a string or a buffer
    at TypeError (native)
    at Hash.update (crypto.js:74:16)
    at HarmonyExportImportedSpecifierDependency.updateHash (/Users/mac/Documents/agorna_phone/node_modules/webpack/lib/dependencies/HarmonyExportImportedSpecifierDependency.js:144:8)
    at /Users/mac/Documents/agorna_phone/node_modules/webpack/lib/DependenciesBlock.js:33:5
    at Array.forEach (native)
    at NormalModule.DependenciesBlock.updateHash (/Users/mac/Documents/agorna_phone/node_modules/webpack/lib/DependenciesBlock.js:32:20)
    at NormalModule.Module.updateHash (/Users/mac/Documents/agorna_phone/node_modules/webpack/lib/Module.js:162:41)
    at NormalModule.updateHash (/Users/mac/Documents/agorna_phone/node_modules/webpack/lib/NormalModule.js:327:30)
    at modules.forEach.m (/Users/mac/Documents/agorna_phone/node_modules/webpack/lib/Chunk.js:253:31)
    at Array.forEach (native)

npm ERR! Darwin 16.7.0
npm ERR! argv "/Users/mac/.nvm/versions/node/v6.11.2/bin/node" "/Users/mac/.nvm/versions/node/v6.11.2/bin/npm" "run" "ionic:serve"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! agorna@0.0.1 ionic:serve: `ionic-app-scripts serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the agorna@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 agorna 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 agorna
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls agorna
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/mac/Documents/agorna_phone/npm-debug.log

notice: Agorna is my app name

This is old and should be upgraded.

1 Like

ionic serve works fine without error but browser not show anything

#inspect element 
Failed to load resource: the server responded with a status of 404 (Not Found)    main.js

If it doesn’t show anything, I wouldn’t define that as “works fine”.

See my previous message.

i upgraded app-scripts but on console have this error
(ionic server failed on first message and after upgrade works fine but on console return this log)

#inspect element 
Failed to load resource: the server responded with a status of 404 (Not Found)    main.js

What is the complete output of ionic serve --verbose?

ionic serve --verbose
Password:
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/mac/Documents/agorna_phone', local: true, binPath:
        '/Users/mac/.nvm/versions/node/v8.4.0/lib/node_modules/ionic/bin/ionic', libPath:
        '/Users/mac/Documents/agorna_phone/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 1021)
[INFO] Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 - Ctrl+C to cancel
[15:21:59]  watch started ...
[15:21:59]  build dev started ...
[15:21:59]  clean started ...
[15:21:59]  clean finished in 4 ms
[15:21:59]  copy started ...
[15:21:59]  transpile started ...
[15:22:10]  transpile finished in 11.21 s
[15:22:10]  preprocess started ...
[15:22:10]  deeplinks started ...
[15:22:10]  deeplinks finished in 21 ms
[15:22:10]  preprocess finished in 25 ms
[15:22:10]  webpack started ...
[15:22:11]  copy finished in 12.13 s
[15:22:34]  webpack finished in 24.11 s
[15:22:34]  sass started ...
[15:22:39]  sass finished in 5.28 s
[15:22:39]  postprocess started ...
[15:22:39]  postprocess finished in 24 ms
[15:22:39]  lint started ...
[15:22:40]  build dev finished in 40.90 s
[15:22:40]  watch ready in 41.35 s
[15:22:40]  dev server running: http://localhost:8100/

[INFO] Development server running
       Local: http://localhost:8100
       External: http://192.168.1.5:8100

[15:22:48]  lint finished in 8.53 s

And when you open that you still get an error?
Can you open it in a different browser?

What is your current ionic info output?

i saw this path www/build/ and main.js not exists !!!
i think this problem taken because its have permission issues

what is your suggestion ?

cli packages: (/Users/mac/Documents/agorna_phone/node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3 browser 4.1.0 ios 4.3.1 windows 4.4.3
    Ionic Framework    : ionic-angular 3.6.1

System:

    Node  : v8.4.0
    npm   : 5.3.0
    OS    : macOS Sierra
    Xcode : Xcode 8.2 Build version 8C38

Replying to the questions I asked and doing what I suggested there.

Why is ionic serve --verbose asking for a password? Are you actually running it with sudo?

i tested two way with sudo and without sudo !!! and output not changed

without sudo

macs-MacBook-Pro:agorna_phone mac$ ionic serve --verbose
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/mac/Documents/agorna_phone', local: true, binPath:
        '/Users/mac/.nvm/versions/node/v8.4.0/lib/node_modules/ionic/bin/ionic', libPath:
        '/Users/mac/Documents/agorna_phone/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 1021)
[INFO] Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 - Ctrl+C to cancel
[16:31:31]  watch started ...
[16:31:31]  build dev started ...
[16:31:31]  clean started ...
[16:31:31]  clean finished in 2 ms
[16:31:31]  copy started ...
[16:31:31]  transpile started ...
[16:31:36]  transpile finished in 5.09 s
[16:31:36]  preprocess started ...
[16:31:36]  deeplinks started ...
[16:31:36]  deeplinks finished in 7 ms
[16:31:36]  preprocess finished in 7 ms
[16:31:36]  webpack started ...
[16:31:36]  copy finished in 5.28 s
[16:31:45]  webpack finished in 8.72 s
[16:31:45]  sass started ...
[16:31:46]  sass finished in 1.49 s
[16:31:46]  postprocess started ...
[16:31:46]  postprocess finished in 7 ms
[16:31:46]  lint started ...
[16:31:46]  build dev finished in 15.36 s
[16:31:47]  watch ready in 15.49 s
[16:31:47]  dev server running: http://localhost:8100/

[INFO] Development server running
       Local: http://localhost:8100
       External: http://192.168.1.5:8100

And now again my questions:

Additonally: Can you create a new project with ionic start and ionic serve that?

hmmm and now i want say whaaaaat happen ? i build new project and serve this project works fine and come back to my project and serve this and works fine :grimacing:

1 Like

Well, I would call this “magic” :wink:

1 Like