How do you resolve modules to use the smartsheet npm package on nodejs?

edited 12/09/19 in API & Developers

I am trying to use the Smartsheet API on nodejs (v8) on windows. When I add the smartsheet npm package, my solution no longer compiles. Easiest way to reproduce (though it reproduces without using create-react-app):

> npx create-react-app solutionname

> cd solutionname

> npm start

It works - your browser comes up with the default page showing.

> npm install --save smartsheet

You now need to reference smartsheet in the project. Open solutionname/src/App.js in your favorite text editor and at the top of the file, under the line that says import './App.css' add a new line, per the API docs:

var client = require('smartsheet');

Save and close the file.

> npm start

The solution no longer compiles. In the browser, you see the following error:

Failed to compile


Module not found: Can't resolve 'request' in 'solutionname\node_modules\smartsheet\lib\utils'

You see the same 'Module not found' error in your console window.


I call it out on windows because when you install the smartsheet npm package, you get a missing optional dependency for fsevents that is skipped because the platform is not OSX. FWIW I get this same exact error on Linux Mint.

Any idea of how this can be resolved to work?



  • J. Craig Williams
    J. Craig Williams ✭✭✭✭✭✭

    I'd suggest asking this on StackOverflow with the smartsheet-api tag, if no one here answers.


  • I ran into this issue too.  The only way I could see how to get around it is to modify the util/httpRequestor.js file (in the Smartsheet SDK); however, since this is a public SDK, someone else probably came up with a way to do this without having to change it, right?


    var request = requestorConfig.request ||

                    Promise.promisifyAll(require("request"), {multiArgs: true});


    var request = requestorConfig.request ||

                    Promise.promisifyAll(require("../request"), {multiArgs: true});