create-nuxt-app icon indicating copy to clipboard operation
create-nuxt-app copied to clipboard

Error to Start New Projects

Open daksamedia opened this issue 4 years ago • 4 comments

Hello Nuxt JS team,

I got a major issue when I started new project

I tried to run

npx create-nuxt-app

It throw me an error

internal/modules/cjs/loader.js:628 throw e; ^ Error: No valid exports main found for '/usr/local/lib/node_modules/create-nuxt-app/node_modules/cac' at resolveExportsTarget (internal/modules/cjs/loader.js:625:9) at applyExports (internal/modules/cjs/loader.js:502:14) at resolveExports (internal/modules/cjs/loader.js:551:12) at Function.Module._findPath (internal/modules/cjs/loader.js:657:22) at Function.Module._resolveFilename (internal/modules/cjs/loader.js:960:27) at Function.Module._load (internal/modules/cjs/loader.js:855:27) at Module.require (internal/modules/cjs/loader.js:1033:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (/usr/local/lib/node_modules/create-nuxt-app/lib/cli.js:5:13) at Module._compile (internal/modules/cjs/loader.js:1144:30) { code: 'MODULE_NOT_FOUND' }

How could this happen? How could I solve it?

Thanks in advance

daksamedia avatar Aug 18 '20 05:08 daksamedia

Hi, may I know are you still having this issue? Just to share my personal experience, I actually noticed I faced similar issue if I'm running npx create-nuxt-app <project-name> while in a poor network connection environment. As we can see in your error, it said was looking into /node_modules/cac, but there is no such module. The modules that are in a new nuxt project with the same starting name are:

  • cacache
  • cacheable-lookup
  • cacheable-request
  • cache-base
  • cache-loader

So I have reason to believe the poor network connectivity caused it to stop downloading halfway, thus causing errors with incomplete files.

Would you mind running npm cache clean --force to remove the faulty create-nuxt-app downloaded by the npx command and retry again?

azrikahar avatar Sep 01 '20 15:09 azrikahar

Hi, I have same problem

hkaplay avatar Sep 03 '20 00:09 hkaplay

Would you mind running npm cache clean --force to remove the faulty create-nuxt-app downloaded by the npx command and retry again?

@HuseyinKaplay Have you tried the solution above?

azrikahar avatar Sep 13 '20 08:09 azrikahar

@azrikahar Yes but they didn't work. I try reinstall node + npm and problem solved.

hkaplay avatar Sep 14 '20 16:09 hkaplay