#Can't run project anymore

12 messages · Page 1 of 1 (latest)

dawn sandal
#

Hello everyone. I've cloned a project locally, but I cannot start it anymore. I did not change the package.json or the pnpm-lock.

I get the following error:

[12:54:16 PM] ERROR Cannot find package 'pkg-types' imported from /home/ralacerda/.local/share/pnpm/store/v10/links/@nuxt/schema/4.0.0/5b30390c172d5c15b0c03786f97989210b84429d36f17ee7828ca08de7ac5055/node_modules/@nuxt/schema/dist/index.mjs
Did you mean to import "pkg-types/dist/index.mjs"?

at Object.getPackageJSONURL (node:internal/modules/package_json_reader:268:9)
at packageResolve (node:internal/modules/esm/resolve:768:81)
at moduleResolve (node:internal/modules/esm/resolve:854:18)
at defaultResolve (node:internal/modules/esm/resolve:984:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:685:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:634:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:617:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:273:38)
at ModuleJob._link (node:internal/modules/esm/module_job:135:49) 

[12:54:16 PM] ERROR Cannot find package 'pkg-types' imported from /home/ralacerda/.local/share/pnpm/store/v10/links/@nuxt/schema/4.0.0/5b30390c172d5c15b0c03786f97989210b84429d36f17ee7828ca08de7ac5055/node_modules/@nuxt/schema/dist/index.mjs
Did you mean to import "pkg-types/dist/index.mjs"?

Here are my dependencies:

  "dependencies": {
    "@floating-ui/vue": "^1.1.7",
    "@nuxt/content": "^3.6.3",
    "@nuxt/eslint": "^1.6.0",
    "@vueuse/core": "^13.5.0",
    "sass": "^1.89.2",
    "sharp": "^0.34.3",
    "vue": "^3.5.17"
  },
  "devDependencies": {
    "@iconify-json/bx": "^1.2.2",
    "@iconify-json/mdi": "^1.2.3",
    "@iconify-json/simple-icons": "^1.2.43",
    "@nuxt/eslint-config": "^1.6.0",
    "@nuxt/fonts": "^0.11.4",
    "@nuxt/icon": "^1.15.0",
    "@nuxt/image": "^1.10.0",
    "@nuxt/scripts": "0.11.8",
    "@nuxtjs/i18n": "9.3.2",
    "@nuxtjs/seo": "^3.1.0",
    "@unhead/vue": "2.0.0-rc.13",
    "eslint": "^9.31.0",
    "nuxt": "^4.0.0",
    "typescript": "^5.8.3",
    "unstorage": "^1.16.1"
  },
quick drumBOT
#

Hi @dawn sandal. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the error message and the knowledge sources, this appears to be a dependency resolution issue with the pkg-types package in your Nuxt 4 project.

The error indicates that @nuxt/schema is trying to import pkg-types, but the package cannot be found in the expected location. This is likely related to how pnpm resolves dependencies in your project.

Recommended Solutions

Based on similar issues in the knowledge sources, here are the steps you should try:

  1. Clear your dependencies and reinstall:

    rm -rf node_modules
    rm pnpm-lock.yaml
    pnpm install
    
  2. Try deduplicating your dependencies:

    pnpm dedupe
    
  3. Update your pnpm version: The knowledge sources show that Nuxt has been updating to newer pnpm versions (like pnpm v10.9.0 and pnpm v10.11.1). Make sure you're using a recent version of pnpm:

    pnpm --version
    # If outdated, update pnpm
    npm install -g pnpm@latest
    
  4. Check your Node.js version: According to the StackBlitz issue, updating from Node 20.x to 22.x resolved similar errors for some users. Ensure you're using a compatible Node.js version.

The knowledge sources indicate that there have been updates to pkg-types (from v1.3.1 to v2.0.1), which included breaking changes and improvements to module resolution. This suggests that dependency resolution issues with pkg-types have been addressed in recent Nuxt updates.

#

If these steps don't resolve the issue, you may need to ensure all your Nuxt-related packages are compatible with Nuxt 4.0.0 and consider updating them to their latest versions.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@dawn sandal Kapa.ai is still learning and improving, please let me know how I did by reacting below.

dawn sandal
#

Now the error changed to:

ERROR Could not load @next wave/scripts. Is it installed? 1:00:45 PM

at loadNuxtModuleInstance (/home/ralacerda/.local/share/pnpm/store/v10/links/@nuxt/kit/4.2.1/ac7f2d2c1da0945da22ab2d4d9ce028acdb713333e5f906b74c6662f1ecb6004/node_modules/@nuxt/kit/dist/index.mjs:734:13)
at async installModules (/home/ralacerda/.local/share/pnpm/store/v10/links/@nuxt/kit/4.2.1/ac7f2d2c1da0945da22ab2d4d9ce028acdb713333e5f906b74c6662f1ecb6004/node_modules/@nuxt/kit/dist/index.mjs:580:17)
at async initNuxt (/home/ralacerda/.local/share/pnpm/store/v10/links/nuxt/4.2.1/55bfc044d240c127ed46f302084d226ec72f41c4f8ce0f26607f6296f04e9d17/node_modules/nuxt/dist/index.mjs:5387:3)
at async loadNuxt (/home/ralacerda/.local/share/pnpm/store/v10/links/nuxt/4.2.1/55bfc044d240c127ed46f302084d226ec72f41c4f8ce0f26607f6296f04e9d17/node_modules/nuxt/dist/index.mjs:5589:5)
at async loadNuxt (/home/ralacerda/.local/share/pnpm/store/v10/links/@nuxt/kit/4.2.1/ac7f2d2c1da0945da22ab2d4d9ce028acdb713333e5f906b74c6662f1ecb6004/node_modules/@nuxt/kit/dist/index.mjs:982:16)
at async Object.run (/home/ralacerda/.local/share/pnpm/store/v10/links/@nuxt/cli/3.30.0/112d6e3aeef6f75e32167387f111eb22fbc0c318dba8b37d9625b27b04fdf77f/node_modules/@nuxt/cli/dist/prepare-DjR-jyiQ.mjs:27:16)
at async runCommand (/home/ralacerda/.local/share/pnpm/store/v10/links/citty/0.1.6/60049a776d643f917e043408961f8cfc126d28cfbf34bde0da9570c32daacc33/node_modules/citty/dist/index.mjs:316:16)
at async runCommand (/home/ralacerda/.local/share/pnpm/store/v10/links/citty/0.1.6/60049a776d643f917e043408961f8cfc126d28cfbf34bde0da9570c32daacc33/node_modules/citty/dist/index.mjs:307:11)
at async runMain (/home/ralacerda/.local/share/pnpm/store/v10/links/citty/0.1.6/60049a776d643f917e043408961f8cfc126d28cfbf34bde0da9570c32daacc33/node_modules/citty/dist/index.mjs:445:7) 

ERROR Could not load @next wave/scripts. Is it installed? 1:00:45 PM

ELIFECYCLE  Command failed with exit code 1.

But @next wave/scripts is installed
@quick drum

quick drumBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

Based on the error message and the knowledge sources, this appears to be a module loading issue with @nuxt/scripts. The error "Could not load /scripts. Is it installed?" suggests that Nuxt is having trouble loading the module even though it's listed in your dependencies.

Understanding the Issue

According to the PR about module compatibility, Nuxt has improved error handling when modules are not compatible with the current version. The knowledge sources mention that "people being surprised by modules (nuxt/scripts) being disabled due to compatibility" has been an issue.

Recommended Solutions

  1. Verify the module is properly installed:

    pnpm install @nuxt/scripts
    
  2. Check your nuxt.config.ts file: Make sure @nuxt/scripts is correctly registered in your modules array. It should look like:

    export default defineNuxtConfig({
      modules: [
        '@nuxt/scripts'
      ]
    })
    
  3. Update to the latest version: Your package.json shows @nuxt/scripts at version 0.11.8. According to the dependency update PR, this version exists, but you might want to try updating to the latest version:

    pnpm update @nuxt/scripts
    
  4. Clear cache and reinstall: Since you're using Nuxt 4.2.1, try clearing everything again:

    rm -rf node_modules .nuxt
    rm pnpm-lock.yaml
    pnpm install
    
  5. Check module compatibility: The knowledge sources indicate that module compatibility checking has been improved in recent Nuxt versions. Your @nuxt/[email protected] should be compatible with Nuxt 4, but if the issue persists, there might be a compatibility problem between the module version and your Nuxt version.

#

If the error persists after these steps, the knowledge sources suggest that this could be related to how the module is being resolved in your specific environment. The error message format indicates this is coming from Nuxt's module loading system, which has been updated to provide better error messages when modules fail to load.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@dawn sandal Kapa.ai is still learning and improving, please let me know how I did by reacting below.

rain pike
#

did you install your dependencies?

#

is there any parent folder with a node_modules/ folder?