Ionic-framework: Ionic 2.0.0 RC.0, getting started, tabs sample app

Created on 28 Sep 2016  路  21Comments  路  Source: ionic-team/ionic-framework

Hi

Very basic. I'm trying out the release candidate, with the sample tabs app.

ionic serve -p $PORT --nolivereload

And I get these errors:

[19:49:15]  src/app/app.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[19:49:15]  src/app/app.module.ts(1,26): error TS2307: Cannot find module '@angular/core'.
[19:49:15]  src/app/main.dev.ts(1,40): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
[19:49:15]  src/pages/about/about.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[19:49:15]  src/pages/contact/contact.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[19:49:15]  src/pages/home/home.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[19:49:15]  src/pages/tabs/tabs.ts(1,27): error TS2307: Cannot find module '@angular/core'.

Should I assume that the tabs sample app has not been updated yet?

Thanks

Tom

Most helpful comment

Ahhh, are you using npm 2?

npm --version

We require npm 3.

That is most likely why you're seeing this issue. Give this a shot please.
https://docs.npmjs.com/getting-started/installing-node#updating-npm

Thanks,
Dan

All 21 comments

It has been. Let me take a quick look. I validated yesterday evening.

Thanks,
Dan

I just did this without any issues:

ionic start myApp -v2
ionic serve

Can you try npm install on your machine in your project folder? I'll reopen if needed.

Thanks,
Dan

i just did

ionic start io -v2 
ionic serve

and

[23:13:29]  src/app/app.component.ts(1,27): error TS2307: Cannot find module '@a
ngular/core'.
[23:13:29]  src/app/app.module.ts(1,26): error TS2307: Cannot find module '@angu
lar/core'.
src/app/main.dev.ts(1,40): error TS2307: Cannot find module '@angular/platform-b
rowser-dynamic'.
src/pages/about/about.ts(1,27): error TS2307: Cannot find module '@angular/core'
.
src/pages/contact/contact.ts(1,27): error TS2307: Cannot find module '@angular/c
ore'.
src/pages/home/home.ts(1,27): error TS2307: Cannot find module '@angular/core'.
src/pages/tabs/tabs.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[23:13:29]  typescript compiler ready in 4.49 s
[23:13:29]  bundle dev started ...
[23:13:29]  Error: Could not resolve '@angular/platform-browser-dynamic' from D:
\dl\io\.tmp\app\main.dev.js
    at Error (native)
    at D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-
resolve\dist\rollup-plugin-node-resolve.cjs.js:78:21
    at D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-
resolve\node_modules\browser-resolve\index.js:265:24
    at D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-
resolve\node_modules\resolve\lib\async.js:46:14
    at process (D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plu
gin-node-resolve\node_modules\resolve\lib\async.js:173:43)
    at ondir (D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugi
n-node-resolve\node_modules\resolve\lib\async.js:188:17)
    at load (D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugin
-node-resolve\node_modules\resolve\lib\async.js:69:43)
    at onex (D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugin
-node-resolve\node_modules\resolve\lib\async.js:92:31)
    at D:\dl\io\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-
resolve\node_modules\resolve\lib\async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

[23:13:29]  sass started ...
[23:13:29]  sass failed:  Cannot generate Sass files without first bundling Java
Script files in order to know all used modules. Please build JS files first.

[23:13:29]  build dev failed:  Build failed

As I'm on cloud9. New blank workspace, then

npm install -g ionic cordova

I was doing this:

ionic start myApp tabs -v2

then:

ionic serve -p $PORT --nolivereload

Not sure if that's any different. But I thought I'd pass it on.

Thanks

Can you take the arguments off of ionic serve? I'm not sure if they'll work anymore to be honest. Hmm, it should be able to find those things.

I can't sadly, it's a cloud9 quirk

my node_modules only consists these and npm install does nothing.
capture

Ahhh, are you using npm 2?

npm --version

We require npm 3.

That is most likely why you're seeing this issue. Give this a shot please.
https://docs.npmjs.com/getting-started/installing-node#updating-npm

Thanks,
Dan

hmm yes..
npm 2.15.9
maybe this should be included also for steps to upgrade?

Good idea, I will add it now. Thanks!

Thanks,
Dan

Yes that was it for me too. Thanks both of you.

Thanks!

@danbucholtz Thanks!
This is a problem often ignored by developers. Best in documentation.

@danbucholtz I also got the same error on ionic serve

[22:47:33]  src/app/app.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[22:47:33]  src/app/app.module.ts(1,26): error TS2307: Cannot find module '@angular/core'.
[22:47:33]  src/app/main.dev.ts(1,40): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
[22:47:33]  src/pages/about/about.ts(1,27): error TS2307: Cannot find module '@angular/core'.
src/pages/contact/contact.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[22:47:33]  src/pages/home/home.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[22:47:33]  src/pages/tabs/tabs.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[22:47:33]  typescript compiler ready in 3.66 s
[22:47:33]  bundle dev started ...
[22:47:33]  Error: Could not resolve '@angular/platform-browser-dynamic' from /home/arvin/mobile/gumanaka/.tmp/app/main.dev.js
Your system information:

Cordova CLI: 6.3.0
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0-beta.3
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID: LinuxMint Description:  Linux Mint 17.3 Rosa 
Node Version: v6.7.0

arvin@arvin-Inspiron-3543 ~/mobile/gumanaka $ npm --version
3.10.8

node_modules

@arkeds,

Can you try updating to npm 3.x? Can you run npm --version and make sure it's 3.x?

Thanks,
Dan

@danbucholtz npm is 3.10.8

arvin@arvin-Inspiron-3543 ~ $ npm --version
3.10.8
`

Can you run npm install again? I don't see the angular modules installed. npm 3 installs modules in a flat hierarchy, which we need.

Thanks,
Dan

@danbucholtz I've tried that, install and update. I've searched for the @angular/core files and it somehow located in ionic-angular/node_modules directory.

angular

So I copy and pasted it to the main node_modules directory and the errors are gone, now I'm just seeing a blank page on the browser.

Here is the package.json file dependencies

"dependencies": {
    "ionic-angular": "^2.0.0-rc.0",
    "ionicons": "^3.0.0",
    "@ionic/storage": "^1.0.3",
    "ionic-native": "^2.0.3"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^0.0.23",
    "typescript": "^2.0.3"
  },

Yep, ionic-angular install @angular/xyz. It really seems like you're running npm 2.x.

Thanks,
Dan

@danbucholtz but the npm version is showing 3.10.8. I've run npm install npm -g multiple times.

I've made the mistake of running it in the wrong directory sometimes?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SebastianGiro picture SebastianGiro  路  3Comments

GeorgeAnanthSoosai picture GeorgeAnanthSoosai  路  3Comments

danbucholtz picture danbucholtz  路  3Comments

manucorporat picture manucorporat  路  3Comments

vswarte picture vswarte  路  3Comments