Skip to content
This repository has been archived by the owner on May 9, 2023. It is now read-only.

Cannot run in production mode #36

Closed
askrht opened this issue Jun 24, 2017 · 1 comment
Closed

Cannot run in production mode #36

askrht opened this issue Jun 24, 2017 · 1 comment
Labels

Comments

@askrht
Copy link
Contributor

askrht commented Jun 24, 2017

Steps:

Execute these commands:

git clean -fxdn
npm install -g ionic cordova
npm install
npm run build

npm install -g http-server

Output:

http-server ./www/ -p 7080
Starting up http-server, serving ./www/
Available on:
  http://127.0.0.1:7080
  http://xxx.xxx.xxx.xxx:7080
Hit CTRL-C to stop the server

Now open localhost:7080 in Chrome and you will see this error in console:

cordova.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.js:60 Uncaught TypeError: Cannot convert undefined or null to object
    at hasOwnProperty (<anonymous>)
    at Function.e.o (main.js:60)
    at Object.<anonymous> (main.js:12221)
    at e (main.js:20)
    at Object.<anonymous> (main.js:55064)
    at e (main.js:20)
    at Object.<anonymous> (main.js:55100)
    at e (main.js:20)
    at Object.<anonymous> (main.js:155787)
    at e (main.js:20)

Even if you add the browser platform, you'd still get the same error.

$ ionic info

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.3.0
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Cordova Platforms               : none
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v6.9.2
    OS         : OS X El Capitan
    Xcode      : Xcode 8.2.1 Build version 8C1002 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    npm        : 3.10.9 

# git log:

3841b33 - (HEAD -> parent, update sh scripts according to the new ionic cli (2 weeks ago) <marco>
f498723 - build(npm): remove phantomjs ref. (2 weeks ago) <marco>
@marcoturi
Copy link
Owner

it's the correct behavior on a normal (web) build you don't have cordova.js. That's why for example you want to mock ionic native plugins. If you are developing for the browser you have to add the browser platform and develop for it. These means also add a build:web task for example to package.json ionic cordova build browser --prod --release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants