ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.14k stars 13.51k forks source link

ionic serve fails #10608

Closed IvanLencina closed 7 years ago

IvanLencina commented 7 years ago

Ionic version: (check one with "x") [ ] 1.x [x ] 2.x

I'm submitting a ... (check one with "x") [x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

I've tried to update to rc4: 2.0.0-rc.4 (2016-12-15)

I used the update guide and then, console throws me:

 A recent change occured in ionic-app-scripts.
Please create a new file "main.ts" containing the content of "main.dev.ts", and then delete  the deprecated files.

So I searched it, and I found this issue . I did these steps, and then when I do: ionic serve --watch , the app is no loading and the browser console throws:

GET http://localhost:8100/build/main.css (index):33
GET http://localhost:8100/build/main.js (index):45
GET http://localhost:8100/build/main.js 404 (Not Found)(index):45 

And terminal throws:

[12:40:01]  ionic-app-scripts 0.0.47 
[12:40:01]  build dev started ... 
[12:40:01]  clean started ... 
[12:40:01]  clean finished in 3 ms 
[12:40:01]  copy started ... 
[12:40:01]  transpile started ... 
[12:40:06]  transpile finished in 5.01 s 
[12:40:06]  webpack started ... 
[12:40:06]  build dev failed: Cannot set property 'fileSystem' of null 
[12:40:06]  ionic-app-script task: "build" 
[12:40:06]  TypeError: Cannot set property 'fileSystem' of null 

Relevant information:

npm -v : 4.0.5
node -v: v6.9.1
ionic info

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v6.9.1
Xcode version: Not installed

Please, help :(

graphefruit commented 7 years ago

[12:40:06] build dev failed: Cannot set property 'fileSystem' of null You're using somewhere the filesystem and try to access it, but it wasn't initialized?

IvanLencina commented 7 years ago

@graphefruit I don't know. It starts happening after try to upgrade. But I just followed the steps of the guide and did nothing else. Before trying to upgrade, I did not give this error.

graphefruit commented 7 years ago

@IvanLencina For me it looks like you got a code problem and not an ionic problem. Did you try to start a new project? ionic start test --v2 and have a look if the issue still exists? If no its something in your codebase.

IvanLencina commented 7 years ago

@graphefruit Yes, if I create a new project, it works. But I don't know how to retrieve my proyect. I have been developing it for about 2 months and everything worked correctly until a moment ago that I wanted to upgrade to take advantage of the improvements they made.

graphefruit commented 7 years ago

@IvanLencina Just search in your project for "fileSystem", "FileSystem" or something like this, I think you have a variable like: let fileSystem:any;

And you try to access this variable. Check if you initialize it before you access it.

IvanLencina commented 7 years ago

@graphefruit I searched "fileSystem" in my project and as far as the code I wrote, there is nothing called fileSystem. All the search results that the editor throws me, come from files that are within node_modules.

This error is not an error of my code, I assure you. Rather it is a problem that arose in some node module, after updating. Or, something weird happened during the update process.

graphefruit commented 7 years ago

So maybe reinstall your ionic plugins (maybe you got there a filetransfer plugin which is outdated?) Also delete your npm_modules and go into command and write: npm install - in same folder.

IvanLencina commented 7 years ago

All the problem started when I wanted to use network-plugin. It result has changed some functions in a later version. So I wanted to upgrade myionic-native version.

So I did it:

npm rm --save ionic native
npm install --save ionic-native@latest
npm update

It comes to see this error: ctorParameters.map is not a function in browser console.

So I tried to upgrade to 2.0.0-rc.4 (2016-12-15), following these steps here and upgrade ion-app-scripts to 0.0.47

And then I started to have this problems:

Browser:

GET http://localhost:8100/build/main.css (index):33
GET http://localhost:8100/build/main.js (index):45
GET http://localhost:8100/build/main.js 404 (Not Found)(index):45 

And terminal: [12:40:06] build dev failed: Cannot set property 'fileSystem' of null

I hope I have explained my self better now

IvanLencina commented 7 years ago

@graphefruit Mmm can be. I'm using the FileTransfer plugin. It may be giving a problem to have been outdated with respect to the new version of ionic

I'll try in a little while

graphefruit commented 7 years ago

Can you update your package.json? Your dependencies should look like:

"dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "ionic-angular": "2.1.0",
    "ionic-native": "2.4.1",
    "ionicons": "3.0.0",
    "rxjs": "5.0.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.1.3",
    "typescript": "2.0.9"
  },

If not, change them, and delete and reinstall the node_modules.

IvanLencina commented 7 years ago

@graphefruit This is my entire package.json:

{
  "name": "ionic-hello-world",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "2.2.1",
    "@angular/compiler": "2.2.1",
    "@angular/compiler-cli": "2.2.1",
    "@angular/core": "2.2.1",
    "@angular/forms": "2.2.1",
    "@angular/http": "2.2.1",
    "@angular/platform-browser": "2.2.1",
    "@angular/platform-browser-dynamic": "2.2.1",
    "@angular/platform-server": "2.2.1",
    "@ionic/storage": "1.1.7",
    "angular2-fullcalendar": "^1.1.1",
    "angularfire2": "^2.0.0-beta.6-preview",
    "firebase": "^3.6.4",
    "ionic-angular": "2.0.0-rc.4",
    "ionic-native": "2.2.11",
    "ionicons": "3.0.0",
    "jquery-ui": "^1.12.1",
    "rxjs": "5.0.0-beta.12",
    "soundcloud": "^3.1.2",
    "zone.js": "0.6.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "0.0.47",
    "typescript": "2.0.9"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-statusbar",
    "cordova-plugin-console",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [],
  "description": "Mindfulness: An Ionic project"
}
graphefruit commented 7 years ago

Ionic-Native and your ionic-angular are some versions behind, aswell as your app-scripts, first update them to the latest Ionic-Native already has now 2.5.1 Delete then your node_modules and npm install

IvanLencina commented 7 years ago

@graphefruit I updated: "ionic-angular": "^2.1.0", "ionic-native": "^2.5.1",

Erased node_modules folder and npm install

But the problem persist :/

graphefruit commented 7 years ago

And app-scripts? 0.0.47 is a long way back ;)

IvanLencina commented 7 years ago

@graphefruit Yes, sorry haha. I updated app-scripts to 1.1.3 and now it's working again!!! :D

So, now I will can do: ionic run --prod

Thank's again. Problem solved!

graphefruit commented 7 years ago

Good! So ;) we're ready to close. Have a nice evening

IvanLencina commented 7 years ago

Thank's, same for you :)

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.