Hi, I’m getting Typescript errors for ionic-angular/component and /navigations files when serving my app, which seems to be linked to the lines starting with ‘readonly’.
I’m new to Ionic, Angular2, and Typescript, but I’ve been at trying to fix this for more than a week, so I’ve updated and downgraded modules, installed the CLI (multiple times), installed the ‘Typings’, upgraded my version of Typescript, and more, all to no avail.
Nevertheless, here is my package.json
Code example:
“dependencies”: {
“
@angular
/common”: “2.0.0”,
“
@angular
/compiler”: “2.0.0”,
“
@angular
/core”: “2.0.0”,
“
@angular
/forms”: “^0.3.0”,
“
@angular
/http”: “2.0.0”,
“
@angular
/platform-browser”: “2.0.0”,
“
@angular
/platform-browser-dynamic”: “2.0.0”,
“
@angular
/platform-server”: “2.0.0”,
“
@types
/request”: “0.0.30”,
“angularfire2”: “next”,
“es6-shim”: “0.35.1”,
“firebase”: “^3.4.0”,
“gulp-typescript”: “^3.0.0”,
“ionic-angular”: “^2.0.0-beta.11-201609011853”,
“ionic-native”: “1.3.10”,
“ionicons”: “3.0.0”,
“reflect-metadata”: “0.1.8”,
“rxjs”: “^5.0.0-beta.12”,
“typescript”: “^2.0.0”,
“zone.js”: “^0.6.25”
“devDependencies”: {
“del”: “2.2.0”,
“gulp”: “3.9.1”,
“gulp-watch”: “4.3.5”,
“ionic-gulp-browserify-typescript”: “2.0.0”,
“ionic-gulp-fonts-copy”: “^1.0.0”,
“ionic-gulp-html-copy”: “^1.0.0”,
“ionic-gulp-sass-build”: “^1.0.0”,
“ionic-gulp-scripts-copy”: “^2.0.0”,
“ionic-gulp-tslint”: “^1.0.0”,
“tslint-ionic-rules”: “0.0.4”,
“run-sequence”: “1.1.5”
“cordovaPlugins”: [
“cordova-plugin-whitelist”,
“cordova-plugin-console”,
“cordova-plugin-statusbar”,
“cordova-plugin-device”,
“cordova-plugin-splashscreen”,
“ionic-plugin-keyboard”
“cordovaPlatforms”: [
“ios”,
“platform”: “ios”,
“version”: “”,
“locator”: “ios”
“name”: “skilltappprototpe”,
“description”: “skilltappPrototpe: An Ionic project”
Error Message:
TypeScript error:/node_modules/ionic-angular/components/img/img.d.ts(24,14): Error TS1005: '=' expected. TypeScript error:/node_modules/ionic-angular/components/img/img.d.ts(24,20): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/img/img.d.ts(25,14): Error TS1005: '=' expected. TypeScript error:/node_modules/ionic-angular/components/img/img.d.ts(25,21): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/label/label.d.ts(11,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/label/label.d.ts(11,18): Error TS1005: ';' expected. TypeScript error:/node_modules/ionic-angular/components/menu/menu-toggle.d.ts(13,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/menu/menu-toggle.d.ts(13,22): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/option/option.d.ts(12,14): Error TS1005: '=' expected. TypeScript error:/node_modules/ionic-angular/components/option/option.d.ts(12,18): Error TS1005: ';' expected. TypeScript error:/node_modules/ionic-angular/components/range/range.d.ts(76,14): Error TS1005: '=' expected. TypeScript error:/node_modules/ionic-angular/components/range/range.d.ts(76,19): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/range/range.d.ts(77,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/range/range.d.ts(77,24): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(40,14): Error TS1005: '=' expected. TypeScript error:/node_modules/ionic-angular/components/select/select.d.ts(40,18): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(40,20): Error TS1068: Unexpected token. A constructor, method, accessor, or property was expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(41,31): Error TS1005: '(' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(42,15): Error TS1005: ';' expected. TypeScript error:/node_modules/ionic-angular/components/select/select.d.ts(42,21): Error TS1109: Expression expected. TypeScript error:/node_modules/ionic-angular/components/select/select.d.ts(44,19): Error TS1005: ',' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(44,25): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(44,31): Error TS1109: Expression expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(45,25): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(45,31): Error TS1109: Expression expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(46,24): Error TS1005: ',' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(46,35): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(46,41): Error TS1109: Expression expected. TypeScript error:/node_modules/ionic-angular/components/select/select.d.ts(47,25): Error TS1005: ',' expected. TypeScript error:/node_modules/ionic-angular/components/select/select.d.ts(47,31): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(47,37): Error TS1109: Expression expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(48,17): Error TS1005: ',' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(48,23): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(48,29): Error TS1109: Expression expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(49,16): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(49,22): Error TS1109: Expression expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(50,18): Error TS1005: ';' expected. TypeScript error:/node_modules/ionic-angular/components/select/select.d.ts(50,24): Error TS1109: Expression expected. TypeScript error: /node_modules/ionic-angular/components/select/select.d.ts(51,1): Error TS1128: Declaration or statement expected. TypeScript error: /node_modules/ionic-angular/components/tabs/tab.d.ts(41,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/tabs/tab.d.ts(41,19): Error TS1005: ';' expected. TypeScript error:/node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(37,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(37,19): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(38,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(38,18): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(39,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(39,18): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(40,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/components/virtual-scroll/virtual-util.d.ts(40,17): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/navigation/nav-controller-base.d.ts(90,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/navigation/nav-controller-base.d.ts(90,21): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/navigation/view-controller.d.ts(49,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/navigation/view-controller.d.ts(49,18): Error TS1005: ';' expected. TypeScript error: /node_modules/ionic-angular/navigation/view-controller.d.ts(50,14): Error TS1005: '=' expected. TypeScript error: /node_modules/ionic-angular/navigation/view-controller.d.ts(50,19): Error TS1005: ';' expected.
ionic-gulp-browserify-typescript/index.js:
var gulp = require(‘gulp’),
browserify = require(‘browserify’),
watchify = require(‘watchify’),
tsify = require(‘tsify’),
pretty = require(‘prettysize’),
merge = require(‘lodash.merge’),
source = require(‘vinyl-source-stream’),
buffer = require(‘vinyl-buffer’),
sourcemaps = require(‘gulp-sourcemaps’),
uglify = require(‘gulp-uglify’),
stream = require(‘stream’);
var defaultOptions = {
watch: false,
src: [‘./app/app.ts’, ‘./typings/index.d.ts’],
outputPath: ‘www/build/js/’,
outputFile: ‘app.bundle.js’,
minify: false,
browserifyOptions: {
cache: {},
packageCache: {},
debug: true
watchifyOptions: {},
tsifyOptions: {},
uglifyOptions: {},
onError: function(err){
console.error(err.toString());
this.emit(‘end’);
onLog: function(log){
console.log((log = log.split(’ ‘), log[0] = pretty(log[0]), log.join(’ ')));
module.exports = function(options) {
options = merge(defaultOptions, options);
var b = browserify(options.src, options.browserifyOptions)
.plugin(tsify, options.tsifyOptions);
if (options.watch) {
b = watchify(b, options.watchifyOptions);
b.on(‘update’, bundle);
b.on(‘log’, options.onLog);
return bundle();
function bundle() {
var debug = options.browserifyOptions.debug;
return b.bundle()
.on(‘error’, options.onError)
.pipe(source(options.outputFile))
.pipe(buffer())
.pipe(debug ? sourcemaps.init({ loadMaps: true }) : noop())
.pipe(options.minify ? uglify(options.uglifyOptions) : noop())
.pipe(debug ? sourcemaps.write(‘./’,{includeContent:true, sourceRoot:‘…/…/…/’}) : noop())
.pipe(gulp.dest(options.outputPath));
function noop(){
return new stream.PassThrough({ objectMode: true });
Help would be greatly appreciated. Thank you.
I noticed latest Ionic2 used rollup for packaging instead of web-pack and gulp.
So I removed all gulp tasks and adds
@ionic
/app-scripts for packaging.
You can find release notes here:
https://github.com/driftyco/ionic/releases
.
You can see what I wrote above. Hope this help you.
Same issue here, I am already using tsc 2.0.3
"typescript":"2.0.3" in devDependencies
with latest ionic-angular
"ionic-angular": "nightly",
with angular 2.0.2
Also I got package version errors when I was trying to run ionic 2rc demo.
npm ERR! peerinvalid The package @angular/[email protected] does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected] npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected] npm ERR! peerinvalid Peer @angular/[email protected] wants @angular/[email protected] npm ERR! peerinvalid Peer [email protected] wants @angular/compiler@^2.0.0 npm ERR! Please include the following file with any support request: npm ERR! C:\Users\Wu\Downloads\ionic-2.0.0-rc.1\demos\npm-debug.log
No problem. Here is my package.json:
“name”: “ionic-hello-world”,
“author”: “Ionic Framework”,
“homepage”: “
http://ionicframework.com/
”,
“private”: true,
“scripts”: {
“build”: “ionic-app-scripts build”,
“watch”: “ionic-app-scripts watch”,
“serve:before”: “watch”,
“emulate:before”: “build”,
“deploy:before”: “build”,
“build:before”: “build”,
“run:before”: “build”
“dependencies”: {
"
@angular
/common": “^2.0.0”,
"
@angular
/compiler": “^2.0.0”,
"
@angular
/compiler-cli": “0.6.2”,
"
@angular
/core": “^2.0.0”,
"
@angular
/forms": “^2.0.0”,
"
@angular
/http": “^2.0.0”,
"
@angular
/platform-browser": “^2.0.0”,
"
@angular
/platform-browser-dynamic": “^2.0.0”,
"
@angular
/platform-server": “^2.0.0”,
"
@ionic
/storage": “^1.0.3”,
“ionic-angular”: “^2.0.0-rc.1”,
“ionic-native”: “^2.2.3”,
“ionicons”: “^3.0.0”,
“rxjs”: “5.0.0-beta.12”,
“zone.js”: “^0.6.21”
“devDependencies”: {
"
@ionic
/app-scripts": “^0.0.36”,
“typescript”: “^2.0.3”
“cordovaPlugins”: [
“cordova-plugin-device”,
“cordova-plugin-console”,
“cordova-plugin-whitelist”,
“cordova-plugin-splashscreen”,
“cordova-plugin-statusbar”,
“ionic-plugin-keyboard”
“cordovaPlatforms”: [
“ios”,
“platform”: “ios”,
“version”: “”,
“locator”: “ios”
“description”: “appname: An Ionic project”
System info:
Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.8.0
Xcode version: Xcode 8.0 Build version 8A218a
Thank you masscreation!
I got the same error with your package.json file. Can you show your tsconfig.json?
This is mine :
{ "compilerOptions": { "target": "es5", "module": "commonjs", "emitDecoratorMetadata": true, "experimentalDecorators": true }, "filesGlob": [ "**/*.ts", "!node_modules/**/*" ], "exclude": [ "node_modules", "typings/global", "typings/global.d.ts" ], "compileOnSave": false, "atom": { "rewriteTsconfig": false } }