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.

[ERR_MODULE_NOT_FOUND]: Cannot find package 'nanoid'

See original GitHub issue

What version of Next.js are you using?

12.0.0

What version of Node.js are you using?

14.18.0

What browser are you using?

Chrome

What operating system are you using?

Windows

How are you deploying your application?

next start

Describe the Bug

Importing package ‘nanoid’ causes error:

error - unhandledRejection: Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'nanoid' imported from .next\server\pages\datasets\catalog\[catalog_id].js
Did you mean to import nanoid-npm-3.1.30-58cf6fe7ec-276d0d4b0c.zip/node_modules/nanoid/index.cjs?

package.json dependencies: "nanoid": "^3.1.30"

Expected Behavior

Successful import

To Reproduce

Occurs when: yarn version 3.1.0 [berry] - without dir node_modules (only /.yarn/cache) and PnP

  • yarn dev
  • yarn build

Minimal reproduce in https://github.com/mufteev/BUG-debugging-with-new-line-in-template-literals

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
mward-sudocommented, Oct 27, 2021

See related issue #30393 with a full reproduction, same issue when using highlight.js package.

0reactions
rtrittocommented, May 6, 2022

@balazsorban44 @timneutkens This issue can be closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module 'nanoid/non-secure' - Stack Overflow
Resolved by directly editing postcss entry in package-lock.json to include "nanoid": "^3.2.23" under requires and "nanoid": {"version" ...
Read more >
How to resolve can't find module error in Node.js - Reactgo
json file and re-install it again using the npm install command. rm -rf node_modules package-lock.json. Can't find modules in local files.
Read more >
Error: Cannot find module 'nanoid-good/generate'-node.js
Coding example for the question "Error: Cannot find module 'nanoid-good/generate'-node.js.
Read more >
module-not-found - Next.js
The swr module has to be installed using a package manager. ... The tree shaking only runs on top level pages, so it...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
I'm getting the error because I'm trying to import the freeCodeCamp icon from the react-icons package, which I don't have installed. import { ......
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