2

I upgraded ionic using npm install -g ionic@4.1.0

I started a new project with ionic start ionic-4-project blank --type=angular

I attempted to serve the project with ionic serve

This is the error message in the console.

> ng run app:serve --host=0.0.0.0 --port=8100
[ng] Could not find API compiler-cli, function VERSION
[ng] Error: Could not find API compiler-cli, function VE
RSION
[ng]     at _error (C:\Users\Me\AppData\Roaming\npm\node
_modules\@angular-devkit\build-angular\node_modules\@ngt
ools\webpack\src\ngtools_api.js:8:11)
[ng]     at getApiMember (C:\Users\Me\AppData\Roaming\np
m\node_modules\@angular-devkit\build-angular\node_module
s\@ngtools\webpack\src\ngtools_api.js:11:32)
[ng]     at Object.<anonymous> (C:\Users\Me\AppData\Roam
ing\npm\node_modules\@angular-devkit\build-angular\node_
modules\@ngtools\webpack\src\ngtools_api.js:50:19)
[ng]     at Module._compile (module.js:652:30)
[ng]     at Object.Module._extensions..js (module.js:663
:10)

[ng]     at Module.load (module.js:565:32)
[ng]     at tryModuleLoad (module.js:505:12)
[ng]     at Function.Module._load (module.js:497:3)
[ng]     at Module.require (module.js:596:17)
[ng]     at require (internal/module.js:11:18)
[ng]     at Object.<anonymous> (C:\Users\Me\AppData\Roam
ing\npm\node_modules\@angular-devkit\build-angular\node_
modules\@ngtools\webpack\src\angular_compiler_plugin.js:
28:23)
[ng]     at Module._compile (module.js:652:30)
[ng]     at Object.Module._extensions..js (module.js:663
:10)
[ng]     at Module.load (module.js:565:32)
[ng]     at tryModuleLoad (module.js:505:12)
[ng]     at Function.Module._load (module.js:497:3)

[ERROR] A utility CLI has unexpectedly closed (exit code
 1).

        The Ionic CLI will exit. Please check any output
 above for error
        details.
net.js:704
    throw new TypeError(

    ^

TypeError: Invalid data, chunk must be a string or buffer, not object
    at WriteStream.Socket.write (net.js:704:11)
    at process.<anonymous> (C:\Users\Me\AppData\Roaming\npm\node_modules\ionic\bin\ionic:9:63)
    at emitTwo (events.js:126:13)
    at process.emit (events.js:214:7)
    at emitPendingUnhandledRejections (internal/process/promises.js:108:22)
    at process._tickCallback (internal/process/next_tick.js:189:7)
PS C:\Users\Me\Desktop\WebApps\fo\ionic-4-pd>

Please let me know what other information you might need. Thank you.

Im on Widows 10 Node version: 8.11.3 Npm version: 6.4.0

Felix Oje
  • 83
  • 2
  • 8

2 Answers2

2

Delete node_modules. Then clear npm cache using 'npm cache clean --verify'. Then do npm install.

Suresh Kumar Ariya
  • 9,516
  • 1
  • 18
  • 27
  • Now it says ```[ng] Could not find API compiler-cli, function VERSION``` – Felix Oje Aug 22 '18 at 10:00
  • Can you please try creating new project in the new worksapce? – Suresh Kumar Ariya Aug 22 '18 at 10:02
  • I created a new project with ```ionic start project-name blank --type=angular``` and I still get the same error message – Felix Oje Aug 22 '18 at 10:09
  • Check what is the ionic version whether its 4. Including Angular Version both locally and globally. You can install ionic and angular version using npm install – Suresh Kumar Ariya Aug 22 '18 at 10:11
  • The version of Ionic is 4. I just upgraded it today. Angular is 6. I will give the exact specs in a moment. – Felix Oje Aug 22 '18 at 10:13
  • How do I check locally versus globally? I typed ```ng -v``` and got angular cli: 6.1.4 and angular: 6.1.3. I also typed ```ionic -v``` and got 4.0.0rc.13 for ionic – Felix Oje Aug 22 '18 at 10:17
  • after typing ```ng -v``` I also see ```@angular-devkit/architect 0.7.4 (cli-only) @angular-devkit/build-angular @angular-devkit/core 0.7.4 (cli-only) @angular-devkit/schematics 0.7.4 (cli-only) @angular/cli @angular/compiler @angular/compiler-cli @angular/language-service @schematics/angular 0.7.4 (cli-only) @schematics/update 0.7.4 (cli-only) rxjs 6.2.2 typescript 2.9.2 (cli-only)``` – Felix Oje Aug 22 '18 at 10:19
  • compiler-cli, compiler, build-angular contains error. try to install using npm install. – Suresh Kumar Ariya Aug 22 '18 at 10:20
  • I tried adding each one but after ```ng -v``` it still shows there are errors where those missing versions are. – Felix Oje Aug 22 '18 at 10:25
  • uninstall angular/cli and install again. "npm uninstall --save-dev angular-cli" "npm install --save-dev @angular/cli@latest" – Suresh Kumar Ariya Aug 22 '18 at 10:28
  • Still the same when I check the versions – Felix Oje Aug 22 '18 at 10:38
  • I appreciate you putting in the time to help me through this. I have not yet resolved this but I now have a better understanding of whats going on. Thank you. – Felix Oje Aug 22 '18 at 13:58
-1

npm config set -g production false

I then started a new project and everything worked fine.

Felix Oje
  • 83
  • 2
  • 8