Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: require(...) is not a function #157

Closed
swyxio opened this issue Mar 16, 2020 · 1 comment
Closed

TypeError: require(...) is not a function #157

swyxio opened this issue Mar 16, 2020 · 1 comment

Comments

@swyxio
Copy link

swyxio commented Mar 16, 2020

I'm really not at all sure why this bug is happening, but when I run copy-template-dir (which uses readdirp) I get this:

/Users/swyx/Netlify/netlify-plugin-search-index/node_modules/copy-template-dir/node_modules/readdirp/readdirp.js:50
    var api          =  require('./stream-api')();
                                               ^

TypeError: require(...) is not a function
    at readdir (/Users/swyx/Netlify/netlify-plugin-search-index/node_modules/copy-template-dir/node_modules/readdirp/readdirp.js:50:48)
    at /Users/swyx/Netlify/netlify-plugin-search-index/node_modules/copy-template-dir/index.js:33:16
    at /Users/swyx/Netlify/netlify-plugin-search-index/node_modules/mkdirp/index.js:48:26
    at callback (/Users/swyx/Netlify/netlify-plugin-search-index/node_modules/graceful-fs/polyfills.js:295:20)
    at FSReqCallback.oncomplete (fs.js:167:5)
error Command failed with exit code 1.

I have checked and yes, stream-api.js is there, however what is unusual is that there are two module.exports that may be screwing things up:

module.exports = ReaddirpReadable;
function ReaddirpReadable (opts) {/* etc */}
function createStreamAPI () {/* etc */}
module.exports = createStreamAPI;

however commenting them out doesnt seem to help at all!

anyone have any idea what the cause of this could be?

@paulmillr
Copy link
Owner

Seems like you're using old version of readdirp. Update to latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants