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.

nuxt nitro generated imports failing at `sm-commons/utils/str` after nuxt bridge upgrade

See original GitHub issue

Versions

  • slice-machine-ui: 0.1.0
  • sm-commons: 0.0.23
  • node: 16.11.1
  • @nuxtjs/bridge: npm:@nuxtjs/bridge-edge (3.0.0-27234503.d5127e9)
  • nuxt-edge: latest (2.16.0-27226092.034b9901)
Additional Details
Logs:

โ„น Full static generation activated                                                           14:31:48
โ„น Nitro preset is server                                                                     14:31:48
โ„น Cleaning up .output                                                                        14:31:48
โ„น Generating output directory: public/                                                       14:31:49
start Building server...                                                                     14:31:49
start Writing server bundle...                                                               14:31:55
โœ” Server built                                                                               14:31:57
  โ”œโ”€ node_modules/.cache/nuxt/nitro/index.mjs.map (1.33 MB) (149 kB gzip)
  โ””โ”€ node_modules/.cache/nuxt/nitro/index.mjs (1.61 MB) (346 kB gzip)
ฮฃ Total size: 2.94 MB (495 kB gzip)
 FATAL  [worker] Cannot find module '/Users/usr/Documents/Github/project/node_modules/sm-commons/utils/str' imported from /Users/usr/Documents/Github/project/node_modules/.cache/nuxt/nitro/index.mjs
Did you mean to import sm-commons/utils/str.js?

Did you mean to import sm-commons/utils/str.js? at new NodeError (node:internal/errors:371:5) at finalizeResolution (node:internal/modules/esm/resolve:416:11) at moduleResolve (node:internal/modules/esm/resolve:932:10) at Loader.defaultResolve [as _resolve] (node:internal/modules/esm/resolve:1044:11) at Loader.resolve (node:internal/modules/esm/loader:89:40) at Loader.getModuleJob (node:internal/modules/esm/loader:242:28) at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40) at link (node:internal/modules/esm/module_job:75:36)

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ โœ– Nuxt Fatal Error โ”‚ โ”‚ โ”‚ โ”‚ Error: [worker] Cannot find module โ”‚ โ”‚ โ€˜/Users/usr/Documents/Github/project/node_modules/sm-commons/utils/strโ€™ imported from โ”‚ โ”‚ /Users/usr/Documents/Github/project/node_modules/.cache/nuxt/nitro/index.mjs โ”‚ โ”‚ Did you mean to import sm-commons/utils/str.js? โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Steps to reproduce

Upgrade an existing nuxt project using slicemachine following nuxt bridge guide: https://v3.nuxtjs.org/getting-started/bridge/

yarn dev works as intended yarn generate fails after nitro server built

What is expected?

Generation should not throw error at sm-commons imports

What is actually happening?

Nitro generates nodes_modules/.cache/nuxt/nitro/index.mjs, adds the import of sm-commons, then throws error at line:

import * as str from 'sm-commons/utils/str';

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
lihbrcommented, Jan 13, 2022

You welcome, just also add sm-commons to it and you should be fine ๐Ÿ˜ƒ

0reactions
LouieRichardson99commented, Apr 13, 2022

You welcome, just also add sm-commons to it and you should be fine ๐Ÿ˜ƒ

Itโ€™s working! Iโ€™ve been trying to figure this out all afternoon. ๐Ÿ˜†

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
Describe the bug. I tried using the nitro property for the nuxt config, as such: nitro: { preset: "server", timing:ย ...
Read more >
Integrating Nuxt Bridge into a Nuxt 2 Project | Cody Bontecou
I followed the Nuxt Bridge documentation. The maintainers of the documentation did a great job of walking me through the process of migrating...
Read more >
Nuxt 3 package import specifier "#internal/nitro" is not defined
If you are using Nuxt and encounter this error, chances likely that this is not the correct solution. Please find another one).
Read more >
ES Modules ยท Nuxt Concepts
Nuxt 3 (and Bridge) uses Native ES Modules. ... Node supports the following kinds of imports (see docs):. files ending in .mjs -...
Read more >
Release Notes - Nuxt
Discover all the release notes for the Nuxt framework.
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