question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors on grunt build using google-api-nodejs-client with webpack

See original GitHub issue

I’m using https://www.npmjs.com/package/googleapis in a ReactJS Webpack app. npm install googleapis --save installed it ok, added "googleapis": "^2.0.2" to my package.json, but when I run grunt build I get the following warnings (followed by lots of errors which I’ll post upon request, as it is a lot of text):

WARNING in ./~/googleapis/apis/index.js
Critical dependencies:
41:23-44 the request of a dependency is an expression
@ ./~/googleapis/apis/index.js 41:23-44

WARNING in ./~/googleapis/~/request/~/hawk/~/hoek/lib/index.js
Critical dependencies:
403:34-60 the request of a dependency is an expression
@ ./~/googleapis/~/request/~/hawk/~/hoek/lib/index.js 403:34-60

Code that requires googleapis in my React component:

var gapi = require('googleapis');

Note: Any other code from the component can be provided on request, but I don’t believe it’s relevant to this issue.

My package.json dependencies:

"dependencies": {
"aws-sdk": "^2.0.21",
"chalk": "^0.5.0",
"crypto-js": "^3.1.2-5",
"cryptojs": "^2.5.3",
"envify": "^1.2.1",
"fluxxor": "1.5.1",
"googleapis": "^2.0.2",
"imports-loader": "^0.6.3",
"jquery": "~2.1.1",
"moment": "^2.8.3",
"react": "0.11.1",
"react-bootstrap": "0.12.0",
"react-router": "0.5.2",
"react-router-bootstrap": "0.5.0"
},
"devDependencies": {
"connect-livereload": "^0.4.0",
"css-loader": "^0.7.0",
"es6-promise": "^1.0.0",
"esrever": "^0.1.0",
"grunt": "^0.4.5",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-less": "~0.11.4",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-git": "^0.2.14",
"grunt-gitinfo": "^0.1.6",
"grunt-karma": "^0.8.3",
"grunt-lesslint": "^1.1.13",
"grunt-rsync": "^0.6.1",
"grunt-ssh": "^0.11.2",
"grunt-webpack": "^1.0.8",
"jssha": "^1.5.0",
"jsx-loader": "^0.10.2",
"karma": "^0.12.17",
"karma-chrome-launcher": "^0.1.7",
"karma-coverage": "^0.2.7",
"karma-jasmine": "^0.1.5",
"karma-js-coverage": "^0.4.0",
"karma-osx-reporter": "^0.1.0",
"karma-phantomjs-launcher": "^0.1.4",
"karma-sourcemap-loader": "^0.3.2",
"karma-webpack": "^1.2.1",
"load-grunt-tasks": "^0.6.0",
"style-loader": "^0.6.4",
"time-grunt": "^1.0.0",
"webpack": "^1.4.15"
}

npm version 2.5.1

node version v0.12.1

Thanks in advance for any help!

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
jmdobrycommented, Apr 18, 2016

google-api-nodejs-client is not meant to be used in a browser—it won’t work. googleapis (google-api-nodejs-client) will work in Node.js. Excluding googleapis from any server-side bundle (just let Node’s module system load it for you) is the best option.

To access Google APIs from a browser, please use the Google API Client Library for JavaScript (gapi).

1reaction
arufiancommented, Aug 23, 2016

+1 @jmdobry case closed.

by the way, in case of fs you can ignore it by add this codes (though not related with this issue)

node: {
    console: 'empty',
    fs: 'empty',
    net: 'empty',
    tls: 'empty'
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Errors on grunt build using google-api-nodejs-client with ...
I'm using https://www.npmjs.com/package/googleapis in a ReactJS Webpack app. It does have a warning that it's an alpha version, so problems are to be...
Read more >
Errors on grunt build using google-api-nodejs-client with ...
To solve the broader problem of how to use Google APIs with a React Webpack app, the NuclearMail Redux-based Gmail client provides an...
Read more >
Getting an error when trying to run grunt build - Google Groups
I was recently trying to use grunt build task but I get the following error: ... acceleration-lab failed with exit code 128 and...
Read more >
grunt-webpack - npm
js. You also need to install webpack yourself, this grunt plugin does not install webpack itself. yarn add webpack grunt-webpack --dev // or...
Read more >
Grunt.js Workflow - Merrick Christensen
Webpack & NPM Scripts have made Grunt useless to me. ... testing, concatenating, and minification behind a task named "build". ... Done, without...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found