fn is not a function
See original GitHub issueI’ve simple test that is as follows
// abc.test.ts
const Client = require('node-rest-client').Client;
import Nightmare from "nightmare";
import * as chai from "chai";
import chaiString from "chai-string";
chai.use(chaiString);
//node_modules\chai\lib\chai.js:39
// fn(exports, util);
// ^
// TypeError: fn is not a function
The npm
command is as follows
mocha --recursive --require jsdom-global/register --require ts-node/register --require babel-core/register tests/domains/*
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to solve "TypeError: fn is not a function"? - Stack Overflow
TypeError : fn is not a function. in this code block of my application const utils = require('./utils') const strategies = require('.
Read more >Type error: fn is not a function. I don't know how to fix that.. Any ...
I've been trying to code a Discord bot to do a Timed mute, but there seems to be an error which I don't...
Read more >TypeError: fn is not a function · Discussion #5548 - GitHub
When I execute the following Javascript test script it returns with TypeError: fn is not a function. Here´s the .js code. async function...
Read more >How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript error TypeError: "x" is not a function occurs when there is an attempt to call a function on a value or...
Read more >TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
closing as
chai
works withrequire
statement.@gary1410 It’s difficult to troubleshoot OP’s issue because they’re using a couple of transpilers. What I can tell you is that “TypeError: fn is not a function” is saying that the value being passed to
chai.use()
isn’t a function, suggesting that the problem is related toimport chaiString from "chai-string";
(as opposed to the Chai import). However, the below example (with no transpilers) works fine for me when runningnode --experimental-modules
with Chai@4.1.2, so I dunno. I’d guess OP’s issue is related to transpiling.