Starting problem when run ionic serve


#1

Hello

I have the following problem.
I down the ionic serve, then when I start the server again, the following message appears and I can not start any more.

Try deleting the node-modules folder and reinstall everything with npm install, but it still gives the same problem.

Come using the ionic without problems every day, but now what can I do?

Thank You.

Message error:

[INFO] Starting app-scripts server: --port 8100 --p 8100 --livereload-port 35729 --r 35729 --address 0.0.0.0 - Ctrl+C to cancel
[12:17:48] watch started …
[12:17:48] build dev started …
[12:17:48] clean started …
[12:17:48] clean finished in 3 ms
[12:17:48] copy started …
[12:17:48] transpile started …
[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/definitions.d.ts, line: 1
Cannot find type definition file for ‘node’.

   L1:  import * as crossSpawnType from 'cross-spawn';
   L2:  import * as inquirerType from 'inquirer';

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/definitions.d.ts, line: 17
Cannot find namespace ‘NodeJS’.

  L16:      stream?: NodeJS.WritableStream;
  L18:  export interface ILogger {

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/definitions.d.ts, line: 22
Cannot find namespace ‘NodeJS’.

  L21:  stream: NodeJS.WritableStream;
  L22:  debug: LogFn;
  L23:  info: LogFn;

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/deploy.d.ts, line: 1
Cannot find type definition file for ‘node’.

   L1:  import { Deploy, DeployChannel, DeploySnapshot, DeploySnapshotRequest, IClient } from '../definitions';
   L2:  export declare class DeployClient {

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/deploy.d.ts, line: 17
Cannot find namespace ‘NodeJS’.

  L16:      uploadSnapshot(snapshot: DeploySnapshotRequest, zip: NodeJS.ReadableStream, progress?: (loaded: number, total: number) => void): Promise<void>;

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/events.d.ts, line: 1
Cannot find type definition file for ‘node’.

   L1:  import { EventEmitter } from 'events';
   L2:  import { ICLIEventEmitter } from '../definitions';

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/events.d.ts, line: 4
Class ‘CLIEventEmitter’ incorrectly implements interface ‘ICLIEventEmitter’. Property ‘on’ is missing in
type ‘CLIEventEmitter’.

   L3:  export declare class CLIEventEmitter extends EventEmitter implements ICLIEventEmitter {

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/package.d.ts, line: 1
Cannot find type definition file for ‘node’.

   L1:  import { IClient, PackageBuild, PackageProjectRequest } from '../definitions';
   L2:  export declare class PackageClient {

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/package.d.ts, line: 22
Cannot find namespace ‘NodeJS’.

  L21:  uploadProject(project: PackageProjectRequest, zip: NodeJS.ReadableStream, {progress}: {
  L22:      progress?: (loaded: number, total: number) => void;
  L23:  }): Promise<void>;

[12:17:53] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/package.d.ts, line: 25
Cannot find namespace ‘NodeJS’.

  L24:  downloadBuild(build: PackageBuild, dest: NodeJS.WritableStream, {progress}: {
  L25:      progress?: (loaded: number, total: number) => void;
  L26:  }): Promise<void>;

[12:17:53] typescript: …ctos_HBS/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/utils/fs.d.ts, line: 1
Cannot find type definition file for ‘node’.

   L1:  import * as fs from 'fs';
   L2:  export declare const ERROR_FILE_NOT_FOUND = "FILE_NOT_FOUND";

[12:17:54] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/utils/fs.d.ts, line: 2
Cannot find module ‘fs’.

   L1:  import * as fs from 'fs';
   L2:  export declare const ERROR_FILE_NOT_FOUND = "FILE_NOT_FOUND";
   L3:  export declare const ERROR_FILE_INVALID_JSON = "FILE_INVALID_JSON";

[12:17:54] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/utils/fs.d.ts, line: 33
Cannot find namespace ‘NodeJS’.

  L32:  export declare function writeStreamToFile(stream: NodeJS.ReadableStream, destination: string): Promise<any>;      L33:  export declare function copyDirectory(source: string, destination: string): Promise<void>;
  L34:  export declare function copyFile(fileName: string, target: string, mode?: number): Promise<{}>;

[12:17:54] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/utils/logger.d.ts, line: 1
Cannot find type definition file for ‘node’.

   L1:  import * as chalk from 'chalk';
   L2:  import { ILogger, LogLevel, LoggerOptions } from '../../definitions';

[12:17:54] typescript: …/Ionic_Proyects/I3Recibo/node_modules/@ionic/cli-utils/lib/utils/logger.d.ts, line: 8
Cannot find namespace ‘NodeJS’.

   L7:  stream: NodeJS.WritableStream;
   L8:  constructor({level, prefix, stream}: LoggerOptions);
   L9:  debug(msg: string | (() => string)): void;

[12:17:54] dev server running: http://localhost:8100/

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

[12:17:54] copy finished in 6.35 s
[12:17:54] watch ready in 6.51 s

ionic info

cli packages:

@ionic/cli-plugin-cordova       : 1.5.0 (C:\Ionic_Proyects\I3Recibo\node_modules\@ionic\cli-plugin-cordova)
@ionic/cli-plugin-ionic-angular : 1.4.0 (C:\Ionic_Proyects\I3Recibo\node_modules\@ionic\cli-plugin-ionic-angular)
@ionic/cli-utils                : 1.6.0 (C:\Ionic_Proyects\I3Recibo\node_modules\@ionic\cli-utils)
ionic (Ionic CLI)               : 3.6.0 (C:\Ionic_Proyects\I3Recibo\node_modules\ionic)

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3 browser 4.1.0 windows 5.0.0
Ionic Framework    : ionic-angular 3.6.0

System:

Node : v8.1.2
OS   : Windows 10
npm  : 5.0.3

#2

I don’t have node 8… but if I were you I’d try this again with Node v 6.11.x I believe 8 is unstable ATM.


#3

Hi, I have been using it for a long time without any problems to program, and so suddenly the server goes down and restarting it gives me this error.
Do not reinstall anything, do not change anything on the computer.
Just try reinstalling the program modules to see if the error was removed.
Is it appropriate to use any other version of a program?


#4

Node 8 is fine, but your version has a security compromise, so it’s strongly recommended to update to the most recent version. The bigger issue is your version of npm. Update to at least 5.3.0 and see if the problem persists.


#5

Aaron, I update to 5.3.0 and the same error to start ionic serve.

But now by mistake upgrade the ionic to version 3.7.0 and now it does not work anymore, when I execute ionic info gives the error:

ionic info
{ Error: Cannot find module '@ionic/cli-utils/lib/init’
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (C:\Ionic_Proyects\I3Recibo\node_modules\ionic\dist\index.js:8:16)
at Module._compile (module.js:624:30)
at Object.Module._extensions…js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3) code: ‘MODULE_NOT_FOUND’ }


#6

Maybe it is convenient to install everything again, as if it were an initial installation, all the full ionic, is an option?


#7

I solved the problem by reinstalling the complete ionic, with the libraries I had in the project.

Thanks for the help.