C:/Users/Mark/Documents/App Development/MYAPP/app/app.ts
Module parse failed: C:\Users\Mark\Documents\App Development\MYAPP\app\app.ts
Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import {App, IonicApp, Platform, MenuController} from ‘ionic-angular’;
| import {HelloIonicPage} from ‘./pages/hello-ionic/hello-ionic’;
| import {ListPage} from ‘./pages/list/list’;
@ multi main (CLI v2.0.0-beta.19)
Your system information:
Cordova CLI: 6.0.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.19
Ionic App Lib Version: 2.0.0-beta.9
OS: Windows 8.1
Node Version: v5.6.0
Thanks, but that is a workaround (to use JS starter rather than Typescript), rather than addressing the issue with the Typescript starter(s) itself. The error appears to be with the Webpack TS loader ‘awesome-typescript’ (its version and/or the Webpack config settings for its use).
As a workaround I used a --v2 --ts with a blank (rather than the tutorial) starter and it served, albeit there is still an error
ERROR in [default] C:/Users/Mark/Documents/App Development/MyAPP/node_modules/
angular2/src/facade/promise.d.ts:1:9
Cannot re-export name that is not defined in the module.
I guess that this is just a heads-up to ionic developers that their Typescript starters need work. I noticed that their GitHUbs for the starters don’t have any app.ts files so it appears there is little support for them at the moment.
@Mobius77, I just tried ionic start MYAPP tutorial --v2 --ts (followed by cd MYAPP and ionic serve) and it worked fine for me, e.g. it started without a Module parse failed error, so it might be something related to your environment.
The second error ERROR in .../angular2/src/facade/promise.d.ts:1:9 is an angular issue caused by the fact that TypeScript 1.8 requires angular2 2.0.0-beta.7 or higher and the current Ionic 2 release (beta3) is using angular2 2.0.0-beta.6. However this is just a temporary problem until the next release of Ionic 2 because the main branch is already updated to angular2 beta8. If you need a workaround now, you can check out the comments in the original issue thread.
Thanks, will update to further releases to see the second error go away for the blank starter that I am using. Thanks also for this link to the TS branch…didn’t see that
Hmm, after I was getting the blank TS starter to serve multiple times yesterday, I am getting the errors in the first post again today after booting my laptop for the first time . In fact, I recall I originally got the TS ‘tutorial’ starter to serve the first time, but then after restarting my laptop a couple of hours later that’s when I got the error. Weird.
It is the same issue as raised here:
I have tried uninstalling and reinstalling webpack, typings and awesome-typescript-loader, as well as configuring TS loader settings in webpack, to no avail. I am not sure if webpack is correctly loading the loader, or what the problem is. TS files are evidently somehow not being recognised anymore.
I am hoping these issues dissipate when Ionic move to Browserify/Gulp as the build tools rather than webpack as per their recent announcement, however it would be good to have it fixed in the interim if anyone’s got any other suggestions (apart from using js files)?
That’s pretty strange, here are some questions/tips:
Do you remember if you updated any packages between the time when it was working and when you got the error?
Do you have webpack installed globally or locally? - The problem might be eventually caused by incompatible package versions or installations, for example I use mostly local packages and have only the following packages installed globally:
Do you run the node.js command prompt as Administrator? - I’m running it with normal privileges and it works but I recall that I read an advice somewhere to run it as Administrator if it doesn’t work.
Here are also excerpts from my configuration files:
The strange thing is that if you try to google this error you’ll end up with results mostly for the babel-loader. I tried to narrow down the search and I found this result for the awesome-typescript-loader: Symlinks seem to cause ‘Line 1: Unexpected token’. I guess that you’re not using shared modules but it might be also caused by something else related to paths (if I recall correctly, I read that sometimes there might be a problem even if node.js is installed on different drive than the one on which your project resides).
It’s totally strange that the only thing in between is the reboot. Maybe you could try to quit (q) after a successful ionic serve and then do another ionic serve immediately. It might be caused not by files that are missing but by some files that are generated after the first serve and somehow block the subsequent executions (e.g. permissions, cache, etc.).
If nothing else helps than you might check the logs (or a way to generate such) or resort to the heavy artillery.
Thanks for the link to the Symlinks discussion (I searched and read many similar issue pages and didn’t see this one) - in there was a suggestion to remove the include in the loader in webpack.config.js which I did:
This enabled the serve to work after reboot - it caused a new and lengthy error to appear regarding FSWatcher but at least the serve always works now. It appears there is an issue with either ‘/app/’ not being an absolute path in the include, or in the resolve,
resolve: {
root: ['app'],
I tinkered for a little while trying to use stuff like include:path.resolve('/app') but that didn’t fix the new FSWatcher error I was getting. In any case the fact that it serves without the include is good enough for me at the moment - I am not going to try to tinker further and get the other error I am now seeing corrected, especially if webpack is not going to be the default loader in a future release of Ionic as recently announced. However, if someone proficient in webpack (this is my first use of it) can immediately see how I should specify the absolute paths for the include/resolve statements etc for the ionic starter then please advise
Thanks again for your time and guidance on this issue!