ionic-framework: 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
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 32 (4 by maintainers)
+1
Not sure if it helps, but I have done
npm cache cleanbefore creating a new project.You are the best. 😉
@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
componentsfolder is inside ofapp.I found how to fix this issue (at least for my app, but maybe will be useful for somebody else). I had
components,services,interfacesfolders inside theappfolder. After moving them one level up (tosrc) and changingimports, build passed successfully.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.
Please update npm to
npm 3.x. You can follow the instructions here: https://docs.npmjs.com/getting-started/installing-node#updating-npmLet me know if that fixes it for you!