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.

Cannot start nuxt: Named export 'rollup' not found

See original GitHub issue

Environment

  • Operating System: Darwin
  • Node Version: v16.12.0
  • Nuxt Version: 3.0.0-27251455.110b2b2
  • Package Manager: npm
  • Bundler: Vite
  • User Config: css, build
  • Runtime Modules: -
  • Build Modules: -

Describe the bug

Nuxt is not able to boot correctly

 ERROR  Cannot start nuxt:  Named export 'rollup' not found. The requested module 'rollup' is a CommonJS module, which may not support all module.exports as named exports.                                                  08:55:26
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'rollup';
const { rollup, watch: watch$1 } = pkg;


  import { rollup, watch as watch$1 } from 'rollup';
  ^^^^^^
  SyntaxError: Named export 'rollup' not found. The requested module 'rollup' is a CommonJS module, which may not support all module.exports as named exports.
  CommonJS modules can always be imported via the default export, for example using:
  
  import pkg from 'rollup';
  const { rollup, watch: watch$1 } = pkg;
  
  at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
  at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)
  at async Promise.all (index 0)
  at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
  at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:784:37)
  at async load (node_modules/nuxi/dist/chunks/dev.mjs:6714:25)
  at async Object.invoke (node_modules/nuxi/dist/chunks/dev.mjs:6756:5)
  at async _main (node_modules/nuxi/dist/chunks/index.mjs:385:7)

Reproduction

It is not necessary

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
pi0commented, Oct 25, 2021

There was a regression in rollup@2.58.1. Fix is being released in few minutes ad7e7551ec8de64b300bd6b61432ce3290c76d3f in v3.0.0-27252573.ad7e755

1reaction
mario-neuholdcommented, Oct 25, 2021

Also getting that new DeprecationWarning when running npx nuxi info

Nuxt project info:                                                                                                                                                                                                                                                                            14:37:26

------------------------------
- Operating System: `Windows_NT`
- Node Version:     `v16.11.1`
- Nuxt Version:     `3.0.0-27252676.79664ad`
- Package Manager:  `Yarn`
- Bundler:          `Vite`
- User Config:      `-`
- Runtime Modules:  `-`
- Build Modules:    `-`
------------------------------
 ERROR  (node:14456) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./dist/" in the "exports" field module resolution of the package at C:\_dev\vue-projects\nuxt3-test\node_modules\rollup\package.json.                                                                    14:37:26  
Update this package.json to use a subpath pattern like "./dist/*".
(Use `node --trace-deprecation ...` to show where the warning was created)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot start nuxt: Named export 'rollup' not found. #1426
It was installed according to the official document of nuxt3, but yarn dev does not work normally. However, an error called ' ERROR...
Read more >
'default' is not exported by node_modules/react/index.js ...
Finally I found what was wrong. I needed the @rollup/plugin-replace plugin to replace process.env.NODE_ENV. Here's the working code.
Read more >
syntaxerror: the requested module 'fs' does not provide an ...
The modules don't seem to be working as expected. I'm running this through a local host server, using node and I just updated...
Read more >
ES Modules · Nuxt Concepts
ES Modules. This guide helps explain what ES Modules are and how to make a Nuxt app (or upstream library) compatible with ESM....
Read more >
Publish ESM and CJS in a single package
ESM enables named exports, better static analysis, tree-shaking, ... on CJS and the migration is not that easy, I found myself more lean...
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