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.

Cannot find module './braintree/test/credit_card_defaults'

See original GitHub issue

Hi all, I’m using the node module of braintree for my project. However, after installing I am getting the following error during runtime. Further investigation shows that the test/ directory does not exist within the node_modules/. How do I resolve this issue?

$ yarn add braintree
yarn add v0.23.2
[1/5] 🔍  Resolving packages...
[2/5] 🚚  Fetching packages...
[3/5] 🔗  Linking dependencies...
[4/5] 📃  Building fresh packages...
[5/5] ♻️  Cleaning modules...
success Saved 1 new dependency.
└─ braintree@2.0.2
✨  Done in 10.12s.

Error stack trace

$ babel-node index.js
{
  "stack": [
    "Error: Cannot find module './braintree/test/credit_card_defaults'",
    "    at Function.Module._resolveFilename (module.js:470:15)",
    "    at Function.Module._load (module.js:418:25)",
    "    at Module.require (module.js:498:17)",
    "    at require (internal/module.js:20:19)",
    "    at Object.<anonymous> (/Users/Developer/Sites/node_modules/braintree/lib/braintree.js:27:26)",
    "    at Module._compile (module.js:571:32)",
    "    at Module._extensions..js (module.js:580:10)",
    "    at Object.require.extensions.(anonymous function) [as .js] (/Users/Developer/Sites/node_modules/babel-register/lib/node.js:152:7)",
    "    at Module.load (module.js:488:32)",
    "    at tryModuleLoad (module.js:447:12)",
    "    at Function.Module._load (module.js:439:3)",
    "    at Module.require (module.js:498:17)",
    "    at require (internal/module.js:20:19)",
    "    at Object.<anonymous> (/Users/Developer/Sites/node_modules/braintree/index.js:3:18)",
    "    at Module._compile (module.js:571:32)",
    "    at Module._extensions..js (module.js:580:10)",
    "    at Object.require.extensions.(anonymous function) [as .js] (/Users/Developer/Sites/node_modules/babel-register/lib/node.js:152:7)",
    "    at Module.load (module.js:488:32)",
    "    at tryModuleLoad (module.js:447:12)",
    "    at Function.Module._load (module.js:439:3)",
    "    at Module.require (module.js:498:17)",
    "    at require (internal/module.js:20:19)"
  ],
  "level": "error",
  "message": "uncaughtException: Cannot find module './braintree/test/credit_card_defaults'",
  "timestamp": "2017-05-02T14:23:18.899Z"
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
crookedneighborcommented, May 2, 2017

I’m not an expert on yarn, but I wonder if there is some kind of configuration file in your project that is messing with something. You’re also one patch release behind, but I didn’t see anything in the release notes that would have indicated a fix for this between version 0.23.2 and 0.23.3.

If you figure out what the issue is, feel free to post it here.

1reaction
crookedneighborcommented, May 2, 2017

Thanks for the info. I’ll check if yarn specifically is doing something strange.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing and Go Live | PHP - Braintree Developer Documentation
The sandbox environment only accepts specific test credit card numbers. Use the credit card values below to trigger different responses from the gateway....
Read more >
Meteor "cannot find module 'braintree'" - Stack Overflow
Just add braintree with npm install braintree. and use it with var braintree = require("braintree");.
Read more >
Magento 2 Braintree Module How Do You Handle Credit Card ...
1 Answer 1. Sorted by: Reset to default. Highest score (default) ...
Read more >
braintree-web-drop-in - Documentation
When true is passed, the 3D Secure module will be created with a default configuration. See threeDSecureOptions for additional create options.
Read more >
Free Braintree Credit Card Gateway Module - Page 2
I am trying to get this Braintree module working. I can't seem to get past the CVS requirement. I am using the Braintree...
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