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

Add support for angular #390

Closed
ceciliazcx opened this issue Jul 23, 2019 · 5 comments
Closed

Add support for angular #390

ceciliazcx opened this issue Jul 23, 2019 · 5 comments
Assignees
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. duplicate frontend type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. web

Comments

@ceciliazcx
Copy link

Error message

ERROR in ./node_modules/google-gax/build/src/operationsClient.js
Module not found: Error: Can't resolve './operations_client_config' in 'C:\Users\chenxi.zhao\workspace\chatbot-designer\node_modules\google-gax\build\src'
ERROR in ./node_modules/google-auth-library/build/src/auth/googleauth.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\chenxi.zhao\workspace\chatbot-designer\node_modules\google-auth-library\build\src\auth'

Environment details

  • OS: WIN 10
  • Node.js version: 10.16.0
  • npm version: 6.9.0
  • dialogflow version:0.10.2

Steps to reproduce

I am very sure the library google-gax and google-auth-library is correct installed.
But I got error as above.
Basically, this is angular8 + universal project.
when I build project with npm run build:ssr, it says the modules not found.
I google a lot, it says google library compact with webpack? I tried everything, but nothing works.

import {Observable} from "rxjs";

import { Intent } from 'src/app/models/intent';

const dialogflow = require('dialogflow');

@Injectable({
providedIn: 'root'
})
export class IntentService {
.......
.......
readonly intentsClient = new dialogflow.IntentsClient(this.opts);
readonly request = {
    parent: this.projectAgentPath,
    intentView: 'INTENT_VIEW_FULL',
};

constructor() { }

fetchIntents(): Observable<Intent[]> {
  return this.intentsClient.listIntents(this.request);
}
}

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@ceciliazcx ceciliazcx changed the title keep throw error to see library not exist keep throw error to google library not exist Jul 23, 2019
@bcoe bcoe added type: question Request for information or clarification. Not an issue. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: question Request for information or clarification. Not an issue. labels Jul 23, 2019
@bcoe
Copy link
Contributor

bcoe commented Jul 23, 2019

👋 hello @ceciliazcx, currently nodejs-dialogflow does not work in a frontend context, as it relies on libraries that exist in Node.js but not the browser, e.g., http2, child_process.

there are efforts in the works to make libraries like dialogflow work for the frontend, but we're not quite there yet.

@bcoe bcoe added the frontend label Jul 23, 2019
@ceciliazcx
Copy link
Author

@bcoe ok. Thx for reply. I basically only want to get intents from dialog flow. Is there any other I can do it from angular?

@JustinBeckwith
Copy link
Contributor

Could you give this library a try?
https://github.com/googleapis/google-api-nodejs-client/

It's less easy to work with, but is known to be webpack-able.

@JustinBeckwith JustinBeckwith changed the title keep throw error to google library not exist Add support for angular Jul 25, 2019
@callmehiphop
Copy link
Contributor

Going to close this as a duplicate of googleapis/google-cloud-node#2933

@frederickjjoubert
Copy link

Hey guys, is angular still not supported? I am trying to add dialog flow to my ionic angular project and got the same error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. duplicate frontend type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. web
Projects
None yet
Development

No branches or pull requests

5 participants