C9 throws '; expected' errors with Angular2 Typescript

angular

#1

I’m getting errors from a .c9 folder whenever I try to use the Angular2 (with Typescript) quickstart from here: https://angular.io/docs/ts/latest/quickstart.html

This is the output in the console whenever I execute npm start:

> angular2@1.0.0 start /home/ubuntu/workspace
> tsc && concurrently "npm run tsc:w" "npm run lite" 
.c9/metadata/workspace/app/app.component.ts(1,10): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,24): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,53): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,91): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,99): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,112): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,122): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,392): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/app.component.ts(1,398): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,407): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,422): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,437): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,451): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,460): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,467): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,478): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,481): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/app.component.ts(1,487): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,494): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,505): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,509): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/app.component.ts(1,523): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,530): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/app.component.ts(1,540): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,556): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,575): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,594): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,600): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/app.component.ts(1,617): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,620): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/app.component.ts(1,632): error TS1005: ';' expected.
.c9/metadata/workspace/app/app.component.ts(1,653): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,10): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,24): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,44): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,73): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,81): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,94): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,104): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,336): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/main.ts(1,342): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,351): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,366): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,381): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,395): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,404): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,411): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,422): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,426): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/main.ts(1,432): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,439): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,450): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,454): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/main.ts(1,468): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,475): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/main.ts(1,485): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,501): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,520): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,539): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,545): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/main.ts(1,562): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,565): error TS1128: Declaration or statement expected.
.c9/metadata/workspace/app/main.ts(1,577): error TS1005: ';' expected.
.c9/metadata/workspace/app/main.ts(1,598): error TS1005: ';' expected.

npm ERR! Linux 4.2.0-c9
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.4.0/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.0/bin/npm" "start"
npm ERR! node v4.4.0
npm ERR! npm  v3.8.8
npm ERR! code ELIFECYCLE
npm ERR! angular2@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the angular2@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
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 angular2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc && concurrently "npm run tsc:w" "npm run lite" 
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/workspace/npm-debug.log

I’ve tried setting this up multiple times but I cannot seem to get it working.
Here is the npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/home/ubuntu/.nvm/versions/node/v4.4.0/bin/node',
1 verbose cli   '/home/ubuntu/.nvm/versions/node/v4.4.0/bin/npm',
1 verbose cli   'start' ]
2 info using npm@3.8.8
3 info using node@v4.4.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular2@1.0.0~prestart: angular2@1.0.0
6 silly lifecycle angular2@1.0.0~prestart: no script for prestart, continuing
7 info lifecycle angular2@1.0.0~start: angular2@1.0.0
8 verbose lifecycle angular2@1.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle angular2@1.0.0~start: PATH: /home/ubuntu/.nvm/versions/node/v4.4.0/lib/node_modules/npm/bin/node-gyp-bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/.nvm/versions/node/v4.4.0/bin:/home/ubuntu/.nvm/versions/node/v4.4.0/bin:/usr/local/rvm/gems/ruby-2.3.0/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin:/mnt/shared/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin
10 verbose lifecycle angular2@1.0.0~start: CWD: /home/ubuntu/workspace
11 silly lifecycle angular2@1.0.0~start: Args: [ '-c', 'tsc && concurrently "npm run tsc:w" "npm run lite" ' ]
12 silly lifecycle angular2@1.0.0~start: Returned: code: 2  signal: null
13 info lifecycle angular2@1.0.0~start: Failed to exec start script
14 verbose stack Error: angular2@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
14 verbose stack Exit status 2
14 verbose stack     at EventEmitter.<anonymous> (/home/ubuntu/.nvm/versions/node/v4.4.0/lib/node_modules/npm/lib/utils/lifecycle.js:244:16)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at EventEmitter.emit (events.js:172:7)
14 verbose stack     at ChildProcess.<anonymous> (/home/ubuntu/.nvm/versions/node/v4.4.0/lib/node_modules/npm/lib/utils/spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:87:13)
14 verbose stack     at ChildProcess.emit (events.js:172:7)
14 verbose stack     at maybeClose (internal/child_process.js:827:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid angular2@1.0.0
16 verbose cwd /home/ubuntu/workspace
17 error Linux 4.2.0-c9
18 error argv "/home/ubuntu/.nvm/versions/node/v4.4.0/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.0/bin/npm" "start"
19 error node v4.4.0
20 error npm  v3.8.8
21 error code ELIFECYCLE
22 error angular2@1.0.0 start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
22 error Exit status 2
23 error Failed at the angular2@1.0.0 start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular2 package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     tsc && concurrently "npm run tsc:w" "npm run lite"
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs angular2
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls angular2
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Anyone knows how to fix this? Even tried some fixes from StackOverflow but those didn’t work either. The file/folderstructure is exactly how it is described in the quickstart guide (Final structure).

angular2
|-- .c9 ...
|-- app
|    |-- app.component.ts
|    |-- main.ts
|-- node_modules ...
|-- typings ...
|-- index.html
|-- package.json
|-- styles.css
|-- tsconfig.json
|-- typings.json

Thanks! :slight_smile:


#2

Hey @Patrick2607,

I was running into the same issue just now. I noticed in the file paths that the error was returning that it is trying to compile files in the .c9/ directory in the project root. The tutorial mentioned the tsconfig.json file controls the ts compiler so I checked in there and realized I needed to add the .c9 directory to the list of excluded directories from which tsc will try to compile.

With the additional directory added to the collection of excluded paths, tsconfig.json looks like:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "exclude": [
    "node_modules",
    "typings/main",
    "typings/main.d.ts",
    ".c9"
  ]
}

I hope this helps anyone else that stumbles upon this thread like I did.

Cheers,
Andrew


#3

It’s work for me. Thank you.


#4

I have tried this solution and it I’m still getting same error:

npm install
npm WARN package.json angular2-quickstart@1.0.0 No description
npm WARN package.json angular2-quickstart@1.0.0 No repository field.
npm WARN package.json angular2-quickstart@1.0.0 No README data

angular2-quickstart@1.0.0 postinstall /home/ubuntu/workspace/angular2-seed
typings install

sh: 1: typings: not found

npm ERR! Linux 4.2.0-c9
npm ERR! argv “/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node” “/home/ubuntu/.nvm/versions/node/v4.4.5/bin/npm” "install"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! angular2-quickstart@1.0.0 postinstall: typings install
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the angular2-quickstart@1.0.0 postinstall script ‘typings install’.
npm ERR! This is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-quickstart
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR!
npm ERR! npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/workspace/angular2-seed/npm-debug.log

I welcome any guidance