Closed Putnug1122 closed 2 years ago
@clarkdo do you mind looking at it when you have time?
Hi Putnug1122,
I had the same error couple hours ago, It seems that this error is kind of new because I found nothing relative to it So I tried multiple things from uninstalling & reinstalling node/npm to changing my npm-cache to another directory (after seeing a stackoverflow npx issue), rebooting etc...
Since nothing changed I opened the file cli.js [...\node_modules\create-nuxt-app\lib\cli.js] and went through cac documentation I tried es6 destructuring assignment and... it just worked I don't know if it will also work for you, it may be related to [...\node_modules\cac\index-compat.js] file
So try to replace line 5 from [...\node_modules\create-nuxt-app\lib\cli.js]:
const cac = require('cac')
to
const { cac } = require('cac')
or
const cac = require('cac').cac
This has been fixed in cac@6.7.11, can you please clear catch and rerun create-nuxt-app agian ?
@clarkdo do you mind looking at it when you have time?
Hi Putnug1122,
I had the same error couple hours ago, It seems that this error is kind of new because I found nothing relative to it So I tried multiple things from uninstalling & reinstalling node/npm to changing my npm-cache to another directory (after seeing a stackoverflow npx issue), rebooting etc...
Since nothing changed I opened the file cli.js [...\node_modules\create-nuxt-app\lib\cli.js] and went through cac documentation I tried es6 destructuring assignment and... it just worked I don't know if it will also work for you, it may be related to [...\node_modules\cac\index-compat.js] file
So try to replace line 5 from [...\node_modules\create-nuxt-app\lib\cli.js]:
const cac = require('cac')
toconst { cac } = require('cac')
orconst cac = require('cac').cac
Ahhh I just replace const cac = require('cac')
to const { cac } = require('cac')
and clear the cache with npm cache clean --force
and it works, thank you
I just want to create a new nuxt app by npx create-nuxt-app, but I got this error
TypeError: cac is not a function at Object.<anonymous> (C:\Users\ASUS\AppData\Local\Yarn\Data\global\node_modules\create-nuxt-app\lib\cli.js:12:13) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47
What just happened ?node version : v14.18.0 create-nuxt-app@3.7.1