contentful-cli icon indicating copy to clipboard operation
contentful-cli copied to clipboard

`mkdirp is not a function` error when running `contentful space seed`

Open cachrisman opened this issue 2 years ago • 2 comments

Expected Behavior

contentful space seed should work without errors

Actual Behavior

when running contentful space seed I get the following error

➜  ~ contentful space seed -t gallery -s abc123 --yes

  ✔ Fetching release information of contentful/content-models
  ✔ Downloading latest release of contentful/content-models
  ✖ Unpacking latest release of contentful/content-models
    → mkdirp is not a function
🚨  Error: mkdirp is not a function
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ TypeError: mkdirp is not a function                                                                                                        │
│     at /Users/cachrisman/.nvm/versions/node/v16.16.0/lib/node_modules/contentful-cli/dist/lib/utils/github.js:42:23                   │
│     at Generator.next (<anonymous>)                                                                                                        │
│     at /Users/cachrisman/.nvm/versions/node/v16.16.0/lib/node_modules/contentful-cli/dist/lib/utils/github.js:8:71                    │
│     at new Promise (<anonymous>)                                                                                                           │
│     at __awaiter (/Users/cachrisman/.nvm/versions/node/v16.16.0/lib/node_modules/contentful-cli/dist/lib/utils/github.js:4:12)        │
│     at Task.task (/Users/cachrisman/.nvm/versions/node/v16.16.0/lib/node_modules/contentful-cli/dist/lib/utils/github.js:41:28)       │
│     at /Users/cachrisman/.nvm/versions/node/v16.16.0/lib/node_modules/contentful-cli/node_modules/listr/lib/task.js:167:30            │
│     at processTicksAndRejections (node:internal/process/task_queues:96:5)                                                                  │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Steps to Reproduce

  1. install contentful-cli
  2. run contentful space seed

Environment

  • Language Version: v16.16.0
  • Package Manager Version: 9.3.0
  • Browser Version: n/a
  • Operating System: macOS Ventura 13.3.1
  • Package Version: 2.3.6

cachrisman avatar Apr 12 '23 09:04 cachrisman

Is there a fix for this yet?

Holay avatar Jul 06 '23 22:07 Holay

I've just run into this as well.

TypeError: mkdirp is not a function                                                                                                                                                                                                                                                         
││     at C:\Users\gwest\AppData\Roaming\nvm\v18.16.0\node_modules\contentful-cli\dist\lib\utils\github.js:42:23                                                                                                                                                                               
││     at Generator.next (<anonymous>)                                                                                                                                                                                                                                                         
││     at C:\Users\gwest\AppData\Roaming\nvm\v18.16.0\node_modules\contentful-cli\dist\lib\utils\github.js:8:71                                                                                                                                                                                
││     at new Promise (<anonymous>)                                                                                                                                                                                                                                                            
││     at __awaiter (C:\Users\gwest\AppData\Roaming\nvm\v18.16.0\node_modules\contentful-cli\dist\lib\utils\github.js:4:12)                                                                                                                                                                    
││     at Task.task (C:\Users\gwest\AppData\Roaming\nvm\v18.16.0\node_modules\contentful-cli\dist\lib\utils\github.js:41:28)                                                                                                                                                                   
││     at C:\Users\gwest\AppData\Roaming\nvm\v18.16.0\node_modules\contentful-cli\node_modules\listr\lib\task.js:167:30                                                                                                                                                                        
││     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Environment

  • contentful-cli: 3.1.43
  • Node.js: v18.16.0 (via NVM)
  • NPM: 9.5.1 (via NVM)
  • OS: Windows 10

gwest4 avatar Feb 27 '24 19:02 gwest4

Same issue.

  • contentful-cli 3.1.44
  • node: 18.19.1
  • npm: 10.2.4

The import is invalid in file lib/utils/github.js at line 7. https://github.com/contentful/contentful-cli/blob/1d47124606e4d62f302b017b124f508d5eeb2751/lib/utils/github.js#L7

Must be : const { mkdirp } = require('mkdirp') instead of const mkdirp = require('mkdirp')

BnitoBzh avatar Mar 13 '24 16:03 BnitoBzh

Hello, issue was resolved in https://github.com/contentful/contentful-cli/pull/2640

Thanks @BnitoBzh for bringing the solution in your comment.

0xAnthony avatar May 01 '24 16:05 0xAnthony

^ +1 thanks all for reporting this, thanks @BnitoBzh for your keen eye and thank you again for contributing the fix @0xAnthony! I'll go ahead and close this issue now.

jjolton-contentful avatar May 01 '24 17:05 jjolton-contentful