Build failing
Short description of the problem:
Cannot build a fresh app. There are multiple errors in the build process (see bellow).
Steps to reproduce:
ionic start --v2 myProjectcd myProjectionic serve
Build log:
...
[00:20:13] src/app/app.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[00:20:13] src/app/app.module.ts(1,26): error TS2307: Cannot find module '@angular/core'.
[00:20:13] src/app/main.dev.ts(1,40): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
[00:20:13] src/pages/about/about.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[00:20:13] src/pages/contact/contact.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[00:20:13] src/pages/home/home.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[00:20:13] src/pages/tabs/tabs.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[00:20:13] typescript compiler ready in 4.38 s
[00:20:13] bundle dev started ...
[00:20:13] Error: Could not resolve '@angular/platform-browser-dynamic' from /Users/ricoo/ownCloud/work/fxe/myProject/.tmp/app/main.dev.js
at Error (native)
at /Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/dist/rollup-plugin-node-resolve.cjs.js:78:21
at /Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/node_modules/browser-resolve/index.js:265:24
at /Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/node_modules/resolve/lib/async.js:46:14
at process (/Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/node_modules/resolve/lib/async.js:173:43)
at ondir (/Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/node_modules/resolve/lib/async.js:188:17)
at load (/Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/node_modules/resolve/lib/async.js:69:43)
at onex (/Users/ricoo/ownCloud/work/fxe/myProject/node_modules/@ionic/app-scripts/node_modules/rollup-plugin-node-resolve/node_modules/resolve/lib/async.js:92:31)
at /Users/ricoo/ownCloud/work/fxe/myProject/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)
[00:20:13] sass started ...
[00:20:13] sass failed: Cannot generate Sass files without first bundling JavaScript files in order to know all used modules. Please build JS files first.
[00:20:13] build dev failed: Build failed
...
Which Ionic Version? 2.0.0-rc.0
Run ionic info from terminal/cmd prompt:
Your system information:
Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.8.5
ios-sim version: 5.0.4
OS: Mac OS X El Capitan
Node Version: v4.4.7
Xcode version: Xcode 8.0 Build version 8A218a
Please update npm to npm 3.x. You can follow the instructions here: https://docs.npmjs.com/getting-started/installing-node#updating-npm
Let me know if that fixes it for you!
This indeed fixed the problem. Thank you!
I will close the issue, but maybe it is worth mentioning it somewhere in a CHANGELOG, because beta.11 worked with the npm 2.x.
Thanks! We added it earlier but let me know if you think there is a better place for us to put it: https://github.com/driftyco/ionic/blob/master/CHANGELOG.md#steps-to-upgrade-to-rc0
You are the best. 😉
I have a the same build error.
Your system information:
Cordova CLI: 6.3.0
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
npm version: 3.10.8
Here is my node_modules files:
@ionic ionic-angular ionic-native ionicons typescript
The '@angular/core' files are located in node_modules/ionic-angular/node_modules/@angular. So I tried moving it to the main node_modules directory, the errors were gone but page is blank
@brandyscarney I'm having the same issue although I updated everything.
Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.0.0-beta.20
OS: Windows 8.1
Node Version: v6.7.0
It is also same on my Vagrant box.
This is the error I am getting:
Running 'serve:before' npm script before serve
> cutepuppypics@ watch C:\www\games\minequiz-new
> ionic-app-scripts watch
[13:50:32] ionic-app-scripts 0.0.23
[13:50:32] watch started ...
[13:50:32] build dev started ...
[13:50:32] clean started ...
[13:50:32] clean finished in 11 ms
[13:50:32] copy started ...
[13:50:32] typescript compiler started ...
[13:50:33] lint started ...
[13:50:33]
(node:4440) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): false
[13:50:33] copy finished in 75 ms
[13:50:36] src/app/app.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[13:50:36] src/app/app.module.ts(1,26): error TS2307: Cannot find module '@angular/core'.
[13:50:36] src/app/main.dev.ts(1,40): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
[13:50:36] 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'.
[13:50:36] src/pages/home/home.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[13:50:36] src/pages/tabs/tabs.ts(1,27): error TS2307: Cannot find module '@angular/core'.
[13:50:36] typescript compiler ready in 3.44 s
[13:50:36] bundle dev started ...
[13:50:36] Error: Could not resolve '@angular/platform-browser-dynamic' from C:\www\games\minequiz-new\.tmp\app\main.dev.js
at Error (native)
at C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\dist\rollup-plugin-node-resolve.cjs.js:78:21
at C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\browser-resolve\index.js:265:24
at C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\resolve\lib\async.js:46:14
at process (C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\resolve\lib\async.js:173:43)
at ondir (C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\resolve\lib\async.js:188:17)
at load (C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\resolve\lib\async.js:69:43)
at onex (C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\resolve\lib\async.js:92:31)
at C:\www\games\minequiz-new\node_modules\@ionic\app-scripts\node_modules\rollup-plugin-node-resolve\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:123:15)
[13:50:36] sass started ...
[13:50:36] sass failed: Cannot generate Sass files without first bundling JavaScript files in order to know all used modules. Please build JS files first.
[13:50:36] build dev failed: Build failed
[13:50:36]
[13:50:36] watch ready in 3.69 s
Running live reload server: http://192.168.2.37:35729
Watching: www/**/*, !www/lib/**/*
√ Running dev server: http://192.168.2.37:8100
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
Any ideas?
Edit: I removed the whole thing and re-installed into a fresh folder using ionic start cutePuppyPics --v2. It works properly now.
On my first installation, it created a folder called cutePuppyPics, so I copied all the content and moved them into ../. Not sure if some paths were hardcoded during the start script. Anyway, my issue is now solved.
@Aristona can you run npm -v so I can see the exact version?
I was having the exact same issue and updated npm version with "npm install npm -g" It now works!
I have the same problem, and I've fix that removing node_modules folder, uninstalling ionic global module and re-install again, and update npm.
Regards.
I have the same problem, any ideas?
ionic v 2.1.0 npm v 3.10.8 node v 4.4.7
@brandyscarney 3.10.8
I have the same problem. Tried the things @agustin107 suggested, but no joy.
ionic v2.1.0 npm v3.10.8 node v5.7.1
UPDATE: I tried creating a new project and then it works. It was the existing project that didn't play along even though I deleted node_modules and reinstalled again.
Same as @svennerberg, no luck after update npm to 3.x on older 2.0RC projects but if you re-start a new fresh project it works like a charm! thanx!
Hi, I've got the same problem and soled it upgrading npm to v3. Maybe the getting started http://ionicframework.com/docs/v2/getting-started/installation/ could have the minimum version requirements (npm, node, cordova...)
Your system information:
Cordova CLI: 6.3.1
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: Not installed
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.3.0
Xcode version: Xcode 8.0 Build version 8A218a
and error:
> ionic-app-scripts watch
[16:29:15] ionic-app-scripts 0.0.23
[16:29:15] watch started ...
[16:29:15] build dev started ...
[16:29:15] clean started ...
[16:29:15] clean finished in 15 ms
[16:29:15] copy started ...
[16:29:15] typescript compiler started ...
[16:29:15] lint started ...
[16:29:15] copy finished in 113 ms
[16:29:17] lint finished in 1.93 s
[16:29:19] typescript compiler ready in 4.18 s
[16:29:19] bundle dev started ...
[16:29:19] Error: Could not resolve entry (./.tmp/app/main.dev.js)
at .../node_modules/rollup/dist/rollup.js:8602:28
at process._tickCallback (internal/process/next_tick.js:103:7)
[16:29:19] sass started ...
[16:29:19] sass failed: Cannot generate Sass files without first bundling JavaScript files in order to know all used modules. Please build JS files first.
[16:29:19] build dev failed: Build failed
+1
I found how to fix this issue (at least for my app, but maybe will be useful for somebody else).
I had components, services, interfaces folders inside the app folder. After moving them one level up (to src) and changing imports, build passed successfully.
update nodejs to 6.7.0, and finally works.
Thanks very much, see you later.
Hello all! Thanks for opening an issue with us! Since it seems like these errors are either caused by running npm 2 or missing something in the process of updating your app I am going to close this issue for now. Thanks for using Ionic!
@jgw96 in my case nothing was missed and everything was up to date. Please consider to mention in docs that Ionic can't work anymore with apps structure when components folder is inside of app.