Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to compile #1

Closed
18steps opened this issue May 5, 2017 · 11 comments · Fixed by #3
Closed

Failed to compile #1

18steps opened this issue May 5, 2017 · 11 comments · Fixed by #3
Assignees
Labels

Comments

@18steps
Copy link

18steps commented May 5, 2017

Following your example, I have

NgModule({
  ...
  imports: [
    ...
    GoogleApiModule.setConfig(
      new GoogleApiConfig(
        CLIENT_ID, DISCOVERY_DOCS, SCOPE
      )
    ),
  ],
  ...
})
export class AppModule { }

But when running ng serve I get an error from Webpack:

ERROR in Error encountered resolving symbol values statically. Calling function 'GoogleApiModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in ...

And in the browser console I get this error:

Uncaught Error: Can't resolve all parameters for factory: ([object Object], ?).
    at syntaxError (http://localhost:4200/vendor.bundle.js:36507:34)
    at CompileMetadataResolver._getDependenciesMetadata (http://localhost:4200/vendor.bundle.js:49844:35)
    at CompileMetadataResolver._getFactoryMetadata (http://localhost:4200/vendor.bundle.js:49724:51)
    at CompileMetadataResolver.getProviderMetadata (http://localhost:4200/vendor.bundle.js:49996:43)
    at http://localhost:4200/vendor.bundle.js:49917:49
    at Array.forEach (native)
    at CompileMetadataResolver._getProvidersMetadata (http://localhost:4200/vendor.bundle.js:49878:19)
    at http://localhost:4200/vendor.bundle.js:49453:63
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (http://localhost:4200/vendor.bundle.js:49444:49)
@rubenCodeforges
Copy link
Owner

rubenCodeforges commented May 5, 2017

Hi have you replaced CLIENT_ID, DISCOVERY_DOCS, SCOPE with yours ?
Could you share perhaps the code ?

Also could you show your package json

@rubenCodeforges
Copy link
Owner

In any case ill be back in the evening , will check it

@18steps
Copy link
Author

18steps commented May 5, 2017

I actually meant the example in README.md, but let's talk about the example project you have, because I've tried it now and I get the same error

ERROR in Error encountered resolving symbol values statically. Calling function 'GoogleApiModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppCommonModule in c:/dev/ng-gapi-example/src/app/common/AppCommonModule.ts, resolving symbol AppCommonModule in c:/dev/ng-gapi-example/src/app/common/AppCommonModule.ts

ERROR in ./src/app/common/AppCommonModule.ts
Module not found: Error: Can't resolve './google/GoogleAuthService' in 'c:\dev\coop\ng-gapi-example\src\app\common'
@ ./src/app/common/AppCommonModule.ts 15:0-63
@ ./src/app/AppModules.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.
webpack: Compiling...
Hash: 890bca36a3beb55b635e
Time: 3219ms
chunk {0} main.bundle.js, main.bundle.js.map (main) 78.9 kB {3} [initial]
chunk {1} styles.bundle.js, styles.bundle.js.map (styles) 525 kB {4} [initial]
chunk {2} scripts.bundle.js, scripts.bundle.js.map (scripts) 2.93 MB {4} [initial]
chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 4.27 MB [initial]
chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry]

ERROR in ./src/app/common/AppCommonModule.ts
Module not found: Error: Can't resolve './google/GoogleAuthService' in 'c:\dev\coop\ng-gapi-example\src\app\common'
@ ./src/app/common/AppCommonModule.ts 15:0-63
@ ./src/app/AppModules.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

@rubenCodeforges
Copy link
Owner

@18steps found the issue , working on a fix, will provide a fix together with the example , i guess today

@rubenCodeforges rubenCodeforges self-assigned this May 5, 2017
@rubenCodeforges
Copy link
Owner

rubenCodeforges commented May 5, 2017

@rubenCodeforges
Copy link
Owner

@18steps ive fixed the issue , ill make some test and then release new version

rubenCodeforges added a commit that referenced this issue May 6, 2017
- refactored npm structure should fix the issue
- updated readme for new configurations
rubenCodeforges added a commit that referenced this issue May 6, 2017
@rubenCodeforges
Copy link
Owner

@18steps the new version is live , please update your npm package, the latest version is 0.0.38
Also check the updated README , the configuration object has changed.

To avoid any caches , remove ng-gapi folder from node-modules, remove ng-gapi entry from package.json and then

npm install ng-gapi --save

@18steps
Copy link
Author

18steps commented May 6, 2017

Thanks. I updated the package according to your instructions, but I still have errors.

In order to use the config type definitions in my module I updated ng-gapi\lib\GoogleApiModule.ts to also export { GapiInitConfigs };.

I got No provider found for [object Object] errors, and then e.g. No provider for GoogleApiConfig so in my module I am providing GoogleApiService, GoogleApiConfig, GoogleAuthService. (AFAIK you chould import and export these so I get them automatically when I import GoogleApiModule)

Still now I have an error

Can't resolve all parameters for GoogleApiConfig

My AppModule code is

const gapiConfig = { scope: ..., discoveryDocs: ..., clientId: ... };
...
  imports: [
    ....
    GoogleApiModule.setConfig(gapiConfig),
  ],
  providers: [
    GoogleApiService,
    GoogleApiConfig,
    GoogleAuthService,
    ...
  ],

@rubenCodeforges
Copy link
Owner

rubenCodeforges commented May 6, 2017

@18steps Hi ive made small adjustment , please update to new version.
Also don provide the libs services , its done inside the lib.
Just try again whats in the README and you should be fine

Latest version 0.0.39

@18steps
Copy link
Author

18steps commented May 6, 2017

Now it works better, thanks. But when I try to use the gapi object it errors. I'm trying to follow the Reporting API example

When I call gapi.client.request(...) I get

TypeError: Cannot read property 'request' of undefined

since there is no client property on the gapi object.

I guess it works in their example because they do

<!-- Load the JavaScript API client and Sign-in library. -->
<script src="https://apis.google.com/js/client:platform.js"></script>

Any chance your library could support gapi.client?

@rubenCodeforges
Copy link
Owner

@18steps this relates to #2 ill finish the example and will ping you in that issue

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

Successfully merging a pull request may close this issue.

2 participants