khaledjendi / SHOPi

SHOPi - Online shopping system [angular, firebase, moltin api]
https://shopi5.herokuapp.com/
Apache License 2.0
17 stars 11 forks source link

Build Error #1

Open patrickburnside opened 5 years ago

patrickburnside commented 5 years ago

I am the following build error, which seems to be due to the Angular CLI versioning. I tried setting the local to be the same as global, but that also did not resolve the issue. Anyone else running into this issue, and/or have suggestions on how to resolve it? Thanks.

Your global Angular CLI version (7.1.3) is greater than your local

version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".

NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/

10% building modules 4/4 modules 0 activewebpack: wait until bundle finished: /

Date: 2018-12-17T12:03:32.562Z

Hash: 77080ae9481d0754e64f

Time: 10638ms

chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered]

chunk {main} main.bundle.js (main) 2.91 kB [initial] [rendered]

chunk {polyfills} polyfills.bundle.js (polyfills) 577 bytes [initial] [rendered]

chunk {scripts} scripts.bundle.js (scripts) 831 kB [initial] [rendered]

chunk {styles} styles.bundle.js (styles) 4.89 MB [initial] [rendered]

chunk {vendor} vendor.bundle.js (vendor) 854 kB [initial] [rendered]

ERROR in Cannot read property 'length' of undefined

webpack: Failed to compile.

khaledjendi commented 5 years ago

Hi,

As I can see in your error log, "our global Angular CLI version (7.1.3) is greater than your local", it means you have the up-to-date Angular CLI. When I built the project last year, the latest was Angular 5.2.0 with Firebase 4.12.1.

I think you have two options to run it.

1 update the package.json file to use the Angular CLI 7.1.3 (the one you have), but note that you might need to change or migrate the code because some Angular CLI 5.2.0 is not compatible with 7.1.3

2 install Angular CLI 5.2.0 rather than Angular CLI 7.1.3 (I consider this a bad or wrong solution)

I am not sure if there is a way to by-pass Angular CLI 5.2.0 procedures with Angular CLI 7.1.3. I have not tried that but I advise you to give it a try so search on google how to run Angular CLI 5.2.0 project on Angular 7.1.3 framework.

One last thing to mention, to run the project locally, you need also to create your own Firebase database, and Moltin API collection. I do not includes these keys in the project. They are usually in and environment.ts and environment.prod.ts files in the angular project but I .gitignore them

If you have a problem with creating Moltin collection or firebase database, then contact me or create a new issue, I will guide you about the schema I used in Moltin and firebase.

Hope this helps

mamayadi commented 5 years ago

Please add the config.ts file and the files in the envirement folder with empty strings just to know what tokens and keys I should add.

And thank you for this amazing project.

khaledjendi commented 5 years ago

Actually I excluded config.ts, environment.ts and environment.prod.ts because they contain sensitive information. You need to create your store at Moltin. In addition, you will need to create your firebase database (or a local database will work though).

for config.ts, it looks like:

import { gateway as MoltinGateway } from '@moltin/sdk';

export class Config {
    static readonly clientID: string = "<your Moltin ClientID>";
    static readonly clientSecret: string = "<your Moltin ClientSecret>";
    static readonly baseImagesUrl = "<your baseImagesUrl in Molin>";

    static readonly Moltin = MoltinGateway({
        client_id: Config.clientID,
        client_secret: Config.clientSecret
    });

    constructor() {

    }
}

while both environment.ts and environment.prod.ts:

export const environment = {
  production: false,
  firebase: {
    apiKey: "<your firebase apiKey>",
    authDomain: "<your firebase authDomain>",
    databaseURL: "<your firebase databaseURL>",
    projectId: "<your firebase projectId>",
    storageBucket: "<your firebase storageBucket>",
    messagingSenderId: "<your firebase messagingSenderId>"
  } 
};

Hope this helps 👍

dashjharana131 commented 4 years ago

please help in creating Moltin collection or firebase database

DaljeetSinghguru commented 1 year ago

After update the package.json file to use the Angular CLI 7.1.3 (the one you have), but note that you might need to change or migrate the code because some Angular CLI 5.2.0 is not compatible with 7.1.3

Error: This command is not available when running the Angular CLI outside a workspace.