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

http2: Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #286

Closed
zjpiazza opened this issue Feb 22, 2019 · 10 comments
Assignees
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. type: question Request for information or clarification. Not an issue. web

Comments

@zjpiazza
Copy link

When trying to use the run the code sample in this repo, I was told I was missing http2 and request packages. So I did as instructed and installed both. After that I received this message:

warning in ./node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js
Critical dependency: the request of a dependency is an expression
warning in ./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
Critical dependency: the request of a dependency is an expression
in ./node_modules/grpc/src/grpc_extension.js
Critical dependency: the request of a dependency is an expression
warning in ./node_modules/http2/lib/protocol/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

I have no idea what is going on or how I can resolve this issue. I thought maybe I introduced some issue so I deleted the project repeated the exact steps and I received the same error.

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Feb 23, 2019
@JustinBeckwith
Copy link
Contributor

Well none of that sounds right. You do not need request or the http2 module to run this - you should really make sure to uninstall those :)

What version of node.js are you using?

@JustinBeckwith JustinBeckwith added the type: question Request for information or clarification. Not an issue. label Feb 26, 2019
@JustinBeckwith JustinBeckwith self-assigned this Feb 26, 2019
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Feb 26, 2019
@zjpiazza
Copy link
Author

zjpiazza commented Feb 26, 2019

I didn't install http2 or request initially but when I imported dialogflow package I started receiving messages that I was missing those dependencies. Using node v10.15.1

@Ifnir
Copy link

Ifnir commented Mar 22, 2019

I get the same errors. Is there a fix yet or work around?

@Anshul0305
Copy link

Anshul0305 commented Apr 2, 2019

I am also getting the same errors:

./node_modules/http2/lib/protocol/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

./node_modules/grpc/src/grpc_extension.js
Critical dependency: the request of a dependency is an expression

./node_modules/grpc/node_modules/node-pre-gyp/lib/pre-binding.js
Critical dependency: the request of a dependency is an expression

./node_modules/grpc/node_modules/node-pre-gyp/lib/util/versioning.js
Critical dependency: the request of a dependency is an expression

@bcoe
Copy link
Contributor

bcoe commented Apr 3, 2019

@Anshul0305 @zjpiazza in the root directory of the project, not the samples directory, could you run:

rm -rf node_modules/.
rm package-lock.json

and

npm i and let us know if there's an error during the node-pre-gyp step? my guess is that the native bindings are failing to build.

@Anshul0305
Copy link

Here is the output of npm install

npm install
npm WARN deprecated http2@3.3.7: Use the built-in module in node 9.0.0 or newer, instead
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github
.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).

> fsevents@1.2.7 install /Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/chokidar/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download 
[fsevents] Success: "/Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" is installed via remote

> fsevents@1.2.4 install /Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/fsevents
> node install

node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.4/fse-v1.2.4-node-v67-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.4 and node@11.13.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
../fsevents.cc:63:6: warning: field 'async_resource' will be initialized after field 'lockStarted' [-Wreorder]
   : async_resource("fsevents:FSEvents"), lockStarted(false) {
     ^
1 warning generated.
  SOLINK_MODULE(target) Release/fse.node
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreServices.framework/CoreServices.tbd and library file /System/Library/Frameworks//CoreServices.framework/CoreServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork.tbd and library file /System/Library/Frameworks//CFNetwork.framework/Versions/A/CFNetwork are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList.tbd and library file /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList are out of sync. Falling back to library file for linking.
  COPY /Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node
  TOUCH Release/obj.target/action_after_build.stamp

> grpc@1.19.0 install /Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download 
[grpc] Success: "/Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node" is installed via remote

> protobufjs@6.8.8 postinstall /Users/Anshul/Documents/Anshul/AWT/ReactJS/react-chat-ui/node_modules/protobufjs
> node scripts/postinstall

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN acorn-jsx@5.0.1 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp@1.0.1 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.

added 1957 packages from 805 contributors and audited 38492 packages in 93.509s
found 63 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
Anshuls-MacBook-Pro:react-chat-ui Anshul$ 

@bcoe
Copy link
Contributor

bcoe commented Apr 4, 2019

@Anshul0305 @zjpiazza I believe that this error you're seeing:

Critical dependency: require function is used in a way in which dependencies cannot be statically extracted.

Is from webpack, and is due to the fact that the nodejs-dialogflow library has compiled dependencies. Modules that have compiled dependencies cannot be pulled in to frontend components that run in the browser, as the browser won't have the native bindings that are built on your machine.

@danfrost
Copy link

I'm having this issue as well. Just moved from the apiai library to dialogflow, removed node_modules and package-lock.json, did npm i and still get the error. Am on mac.

@bcoe
Copy link
Contributor

bcoe commented Apr 29, 2019

@danfrost are you using React, and/or Webpack? Unfortunately @google-cloud/nodejs-dialogflow will not currently work in a browser environment.

@bcoe
Copy link
Contributor

bcoe commented Apr 29, 2019

@zjpiazza I'm closing this issue, as a duplicate of #16, we'd very much love to support Webpack in the not too distant future -- but unfortunately it's not supported today.

@danfrost If you're having an issue that isn't webpack related, please feel free to open a new issue 👍 otherwise, please feel free to join the conversation on #16.

@bcoe bcoe closed this as completed Apr 29, 2019
@google-cloud-label-sync google-cloud-label-sync bot added the api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. label Jan 31, 2020
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. type: question Request for information or clarification. Not an issue. web
Projects
None yet
Development

No branches or pull requests

7 participants