Having Problems with Dependencies when Using React

I started a new Glitch project as a remix of the starter-react-template simply to test my skills with React. All was well for as long as I worked on it (about 2 or 3 hours), then I logged off of Glitch. I came back a few hours later as I wanted to show someone my project only to find that my app was not functioning! I see the following message:

  failed to start application on counter-app-react.glitch.me

  This is most likely because your project has a code error.
  Check your project logs, fix the error and try again.  

This message confused me, as I had made no changes and everything was working earlier. Then, I checked my logs and I found this error:

WARN  Moving react that was installed by a different package manager to "node_modules/.ignored
ERROR  ENOTEMPTY: directory not empty, rename '/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/react' -> '/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/.ignored/react'

I’m not sure why this happened, but it did nonetheless! So, I got to researching. During this period, I found a similar topic involving discord.js. That can be found here. Their error message, similarly, stated the following:

node v10.16.3, with pnpm

Installing...

 WARN  Moving discord.js that was installed by a different package manager to "node_modules/.ignored

ERROR  ENOTEMPTY: directory not empty, rename '/rbd/pnpm-volume/a5584077-6f69-4bb7-83fa-871d59d414eb/node_modules/discord.js' -> '/rbd/pnpm-volume/a5584077-6f69-4bb7-83fa-871d59d414eb/node_modules/.ignored/discord.js'

I have no idea what is going on, but I scrolled to the bottom of this topic to find this message:

Could you try starting up your bot now and see if everything works!
The problem was that you had node listed as a dependency, so I removed it then ran

rm -rf shrinkwrap.yaml
rm -rf node_modules
enable-pnpm

then I let the install proceed and I saw no errors that time!

I used the code provided, and deleted both shrinkwrap.yaml and the more notable node_modules from the first error. This only brought more errors, of course, as I now had no connection to any packages listed in node_modules! So, I found a Stack Overflow post that mentioned using npm install to re-install a missing node_modules folder. I have no idea what I installed, but I did not get a node_modules folder from the looks of it!

As my adventures come to an end, I then decided to copy/paste all of my code over to a new starter-react-template project, only to get the same errors! My most recent error messages (from BOTH projects) are as follows…

From the original project:

/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/queue-microtask/index.js:5

8:14 PM

? queueMicrotask.bind(globalThis)

8:14 PM

^

8:14 PM

8:14 PM

ReferenceError: globalThis is not defined

8:14 PM

at Object.<anonymous> (/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/queue-microtask/index.js:5:25)

8:14 PM

at Module._compile (internal/modules/cjs/loader.js:816:30)

8:14 PM

at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)

8:14 PM

at Module.load (internal/modules/cjs/loader.js:685:32)

8:14 PM

at Function.Module._load (internal/modules/cjs/loader.js:620:12)

8:14 PM

at Module.require (internal/modules/cjs/loader.js:723:19)

8:14 PM

at require (internal/modules/cjs/helpers.js:14:16)

8:14 PM

at Object.<anonymous> (/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/run-parallel/index.js:4:24)

8:14 PM

at Module._compile (internal/modules/cjs/loader.js:816:30)

8:14 PM

at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)

From the copied project:

internal/modules/cjs/loader.js:670

8:15 PM

throw err;

8:15 PM

^

8:15 PM

8:15 PM

Error: Cannot find module '/rbd/pnpm-volume/0d69220b-cb06-43c6-ae93-02f66422fb73/node_modules/react-scripts/bin/react-scripts.js'

8:15 PM

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)

8:15 PM

at Function.Module._load (internal/modules/cjs/loader.js:591:27)

8:15 PM

at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)

8:15 PM

at internal/main/run_main_module.js:21:11

Also note that I am using Bootstrap, so when I created the new project, I also used NPM to re-install react-bootstrap using:

npm install react-bootstrap bootstrap

However, I did not see any Bootstrap dependencies in my package.json. So that is also weird.


Anyway, I’m really at a loss here, so any help would be MUCH appreciated. Thanks in advance. :slight_smile:

When using pnpm, it doesn’t create node_modules, as far as I know. When running commands in the terminal, the editor won’t refresh to reflect tgese changes, so you should always run refresh in the terminal after installing. That might hace been the problem. It would also be great if you could give us a link to your project too, that would be great.

Ahh, apologies. Here are the project (cannot put more than two links in my original post as a new user):

Original Project:
https://counter-app-react.glitch.me

New Project:
https://counter-app-react-v2.glitch.me

Upon closer inspection, one of the original errors reads:

WARN  Moving react that was installed by a different package manager to "node_modules/.ignored
ERROR  ENOTEMPTY: directory not empty, rename '/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/react' -> '/rbd/pnpm-volume/6a0ce0db-cf71-4731-b0db-69533952944c/node_modules/.ignored/react'

Could my original error simply have been a file path error because the react dependency was moved? Also, why was the react dependency moved?