Ionic Serve Won't Run due to module.js:471 throw err


#1

Cannot get ionic serve to run due to the following. Have already run npm install. What have I forgotten to do?

module.js:471
throw err;
^

Error: Cannot find module 'C:\Users\Michael\Documents\SaveSoft 3\savesoft\ionic2-ts-sidemenu1\node_modules\ionic\bin\ionic’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:383:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:496:3


#2

What is your ionic info output?


#3

cli packages: (C:\Users\Michael\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0

global packages:

cordova (Cordova CLI) : not installed

local packages:

@ionic/app-scripts : 1.1.0
Cordova Platforms  : none
Ionic Framework    : ionic-angular 2.0.1

System:

Node : v6.11.4
npm  : 2.15.12
OS   : Windows 10

Misc:

backend : pro

warning: LF will be replaced by CRLF in ionic2-ts-sidemenu1/config.xml.
The file will have its original line endings in your working directory.


#4

This is ancient. Update.


#5

thanks. now a bunch of typescript errors:

Typescript Error
Class ‘Tabs’ incorrectly implements interface ‘NavigationContainer’. Types of property ‘parent’ are incompatible. Type ‘NavControllerBase’ is not assignable to type ‘NavController’. Types of property ‘popTo’ are incompatible. Type ‘(indexOrViewCtrl: any, opts?: NavOptions, done?: () => void) => Promise’ is not assignable to type ‘(page: string | Page | ViewController, params?: any, opts?: NavOptions, done?: Function) => Promi…’. Types of parameters ‘done’ and ‘opts’ are incompatible. Type ‘NavOptions’ is not assignable to type ‘() => void’.

Typescript Error
Type ‘IterableDiffer’ is not generic.

Typescript Error
Class ‘NavControllerBase’ incorrectly implements interface ‘NavController’. Types of property ‘popTo’ are incompatible. Type ‘(indexOrViewCtrl: any, opts?: NavOptions, done?: () => void) => Promise’ is not assignable to type ‘(page: string | Page | ViewController, params?: any, opts?: NavOptions, done?: Function) => Promi…’. Types of parameters ‘done’ and ‘opts’ are incompatible. Type ‘NavOptions’ is not assignable to type ‘() => void’. Type ‘NavOptions’ provides no match for the signature ‘(): void’.

Typescript Error
Class ‘Subject’ incorrectly extends base class ‘Observable’. Types of property ‘lift’ are incompatible. Type ‘<T, R>(operator: Operator<T, R>) => Observable’ is not assignable to type ‘(operator: Operator<T, R>) => Observable’. Type ‘Observable’ is not assignable to type ‘Observable’. Type ‘T’ is not assignable to type ‘R’.

Typescript Error
Cannot find name ‘NativeGeocoder’.

Typescript Error
Cannot find name ‘LocationAccuracy’.

Typescript Error
Argument of type ‘{ enableHighAccuracy: boolean; }’ is not assignable to parameter of type ‘PositionCallback’. Type ‘{ enableHighAccuracy: boolean; }’ provides no match for the signature ‘(position: Position): void’.

Typescript Error
Cannot find name ‘Geoposition’.

Typescript Error
Cannot find name ‘NativeGeocoderReverseResult’.


#6

Does it work if you create a new project with ionic start?


#7

No, I’m afraid not. By the way, as I’m sure you can tell the project was cloned from a private repository and not started locally. – am about to get some desktop support and will report back with any success!


#8

Where is your project located?
What does where.exe ionic return?
What does it output if you ionic start? No errors but all working?


#9

Where.exe ionic returns:
C:\Users\Michael\source\repos\savesoft\ionic2-ts-sidemenu1\ionic
C:\Users\Michael\source\repos\savesoft\ionic2-ts-sidemenu1\ionic.cmd
C:\Users\Michael\AppData\Roaming\npm\ionic
C:\Users\Michael\AppData\Roaming\npm\ionic.cmd

Yes no problem with ionic start.

I’ve managed to remove most problems by upgrading all packages in package.json. Now I’m left with only the following error when trying to build:

[17:03:16] ionic-app-script task: “build”
[17:03:16] SyntaxError: Unexpected token {
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions…js (module.js:404:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (\node_modules@ionic\app-scripts\node_modules@angular-devkit\build-optimizer\src\build-optimizer\webpack-loader.js:12:27)
at Module._compile (module.js:397:26)
at Object.Module._extensions…js (module.js:404:10)

I’ve seen a different topic on this (https://stackoverflow.com/questions/46716631/updated-to-ionic-3-from-ionic-2-now-unable-to-build-due-to-unexpected-token) but the author doesn’t explain how exactly the problem was resolved in the end.