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.

Error when running Node API examples (Cannot find module './src/api/test_profile')

See original GitHub issue

CLI Installation method

  • NPM / NPX
  • Binary

Output of calibre --version

1.0.8

Operating system

  • Mac
  • Windows
  • Linux

What you expected to happen

Following instructions in docs to be able to run the sample JS files which use the API.

What happened

Every example script I run results in the same error:

Error: Cannot find module './src/api/test_profile' Error: Cannot find module './src/api/test_profile' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object.<anonymous> (/Users/henry/git/calibre-cli/examples/nodejs/node_modules/calibre/index.js:16:21) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3)

Steps to Reproduce (for bugs)

$ git clone git@github.com:calibreapp/cli.git calibre-cli
$ cd calibre-cli/examples/nodejs/
$ npm install
npm WARN calibre-nodejs-examples@1.0.0 No repository field.

added 160 packages in 7.08s
$ CALIBRE_API_TOKEN=blah ./list-agent-locations.js
module.js:549
    throw err;
    ^

Error: Cannot find module './src/api/test_profile'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/henry/git/calibre-cli/examples/nodejs/node_modules/calibre/index.js:16:21)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)

$ node --version
v8.11.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benschwarzcommented, Jul 5, 2018

@hjst Yep, I just added these exports https://github.com/calibreapp/cli/pull/20/files#diff-168726dbe96b3ce427e7fedce31bb0bc, we’ll get them out in the next release.

0reactions
benschwarzcommented, Jul 20, 2018

1.1.0 has been released 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
In my case, I need to install the react-icons package so the freeCodeCamp icon can be resolved. I'll do that by running yarn...
Read more >
CommonJS modules | Node.js v19.3.0 Documentation
Variables local to the module will be private, because the module is wrapped in a function by Node.js (see module wrapper). In this...
Read more >
Cannot find module 'X' error in Node.js | bobbyhadz
Open your terminal in your project's root directory (where your package.json file is located) and run the following commands. shell.
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
To fix the Cannot find module error, simply install the missing modules using npm . To so, you can use the following command:...
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