question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

package import specifier "#internal/nitro" is not defined in package when running `npm run generate` on windows

See original GitHub issue

Environment


  • Operating System: Windows_NT
  • Node Version: v16.13.1
  • Nuxt Version: 3.0.0-rc.1
  • Package Manager: npm@8.1.2
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

npx nuxi init nuxt-app
cd nuxt-app
npm install
npm run generate

Describe the bug

Trying out Nuxt 3 for the first time, I mainly care for deploying statically generated sites. I tried out npm run generate and got this error: Package import specifier “#internal/nitro” is not defined in package.

Additional context

No response

Logs

ERROR  [nuxt] [request error] Package import specifier "#internal/nitro" is not defined in package D:\1stuff\dev\2022\prisma-rest-express\nuxt-app\package.json imported from D:\1stuff\dev\2022\prisma-rest-express\nuxt-app\.nuxt\dist\server\server.mjs
  at new NodeError (node:internal/errors:371:5)
  at throwImportNotDefined (node:internal/modules/esm/resolve:429:9)
  at packageImportsResolve (node:internal/modules/esm/resolve:778:3)
  at moduleResolve (node:internal/modules/esm/resolve:924:21)
  at defaultResolve (node:internal/modules/esm/resolve:1044:11)
  at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
  at link (node:internal/modules/esm/module_job:75:36)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:29
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
miskomvcommented, May 12, 2022

With version 3.0.0-rc.3 still gives the same error.

I understand that it is normal because they have not said that they have corrected it in this update xD, but this way I avoid you to test it this RC.

5reactions
miskomvcommented, May 5, 2022

Same here, this is my use-case and its failing on Windows.

In linux the command works correctly so, in the worst case, I can launch it from there.

fail

I think is some type of a problem with the alias in windows:

node_modules@nuxt\vite-builder\dist\index.mjs

    resolve: {
      alias: {
        "#build/plugins": resolve(ctx.nuxt.options.buildDir, "plugins/client"),
        "#internal/nitro": resolve(ctx.nuxt.options.buildDir, "nitro.client.mjs")
      }
    },

node_modules\nuxt\dist\index.mjs

const clientConfigTemplate = {
  filename: "nitro.client.mjs",
  getContents: () => `export const useRuntimeConfig = () => window?.__NUXT__?.config || {}`
};

I’ve only tracked up to that point, I don’t even know if it could be useful xD

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt 3 package import specifier "#internal/nitro" is not defined
Im not sure, but I guess your npm is trying to find the module #internal/nitro on your package.json which is dist\server\server. · Got...
Read more >
npm-init | npm Docs
initializer in this case is an npm package named create-<initializer> , which will be installed by npm-exec , and then have its main...
Read more >
npm-exec
This command allows you to run an arbitrary command from an npm package (either one installed locally, or fetched remotely), in a similar...
Read more >
npx - npm Docs
The --package option may be specified multiple times, to execute the supplied command in an environment where all specified packages are available.
Read more >
http-server - npm
Start using http-server in your project by running `npm i http-server`. ... As a dependency in your npm package: npm install http-server ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found