Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fresh install of single-spa-react is missing lib and parcel directories #176

Closed
splomax opened this issue Jun 26, 2023 · 2 comments
Closed

Comments

@splomax
Copy link

splomax commented Jun 26, 2023

Hi, I'm working on a project that uses single-spa and single-spa-react. I had to remove my node_modules folder and do a fresh install. After doing so, my project started throwing errors on start, specifically complaining about this:

ERROR in ./src/redacted.js 3:0-46
Module not found: Error: Can't resolve 'single-spa-react' in 'C:\projects\redacted\src'
resolve 'single-spa-react' in 'C:\projects\redacted\src'
  Parsed request is a module
  using description file: C:\projects\redacted\package.json (relative path: ./src)
    Field 'browser'

Here's how I'm attempting to access single-spa-react in the file it's complaining about:

...
import singleSpaReact from 'single-spa-react';
...
const lifecycles = singleSpaReact({
    React,
    ReactDOM,
    rootComponent: Root,
    errorBoundary(err, info, props) {
        // Customize the root error boundary for your microfrontend here.
        return null;
    },
});
...

I tried several fresh installs, cleaning my cache, etc., and couldn't get rid of this error. I have several other projects that use single-spa-react, so I decided to investigate their node_modules/single-spa-react directories to see if there were any discrepancies. Here's what I found. In an older project, node_modules/single-spa-react looks like this:

node_modules
--single-spa-react
----lib
----parcel
----types
--LICENSE
--package.json
--README.md

However, the repo with the fresh install looks like this:

node_modules
--single-spa-react
----types
--LICENSE
--package.json
--README.md

The lib and parcel directories are missing. To make sure this is what was causing the issue, I replaced node_modules/single-spa-react with the copy from the older repo, and that did fix the problem.

In case there was an issue with the machine I'm working on, I recreated this issue on a different computer in a completely fresh npm project. The package.json looks like this:

{
  "name": "single-spa-react-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "single-spa-react": "^5.1.0"
  }
}

This results in the same thing - single-spa-react-test/node_modules/single-spa-react is missing the lib and parcel directories. Can I get any guidance on what I can/should do to fix this? Thanks!

@puryganikita
Copy link

puryganikita commented Jun 26, 2023

You are not the only one who has faced this problem. There is a solution to your question in this thread.

@joeldenning
Copy link
Member

Duplicate of #173

@joeldenning joeldenning marked this as a duplicate of #173 Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants