Cannot Find Module 'block-stream' - reactjs

I'm trying to make a new react-js site using npx create-react-app
The Error I get is Error: Cannot find module 'block-stream'
I redownloaded node and tried again but still getting the same error
what can I try to fix this?

Correct me if I'm wrong on anything here, I'm not really a React or Node developer.
However, I'd guess, if it's an addon or additional package, it may not be installed by default. You might try figuring out if you can install it, somehow.
I don't know if this is what you meant, but I did find this webpage with some details on installing it.
In addition, if you don't want to use blockstream, and didn't intentionally include it, and this error is being shown to you for seemingly no reason, I'd suggest looking through your codebase to find any references to that code.
I wish you luck :)

Related

I keep seeing ShortMove on Chess.js tutorials, but it's not there anymore

I'm trying to make a chess game using react. I am using chessboardjsx and chess.js. I am working with an online tutorial:
https://levelup.gitconnected.com/how-to-create-a-simple-chess-app-with-react-e18c0179b167
In this, they use ShortMove to handle moves, but it gives me an error when I try to import it because it's not in Chess.js. Maybe I'm doing something stupid but I think it was removed or changed in Chess.js.
Here is an image to show the issue.
](https://i.stack.imgur.com/C7Amy.png)
I tried to use Move rather than ShortMove, but Move needs a bunch of properties like color, piece, flag, and sans, which ShortMove doesn't need. Here's the error I get.
Can someone tell me if there is an alternative or how I can make Move work? Thanks in advance!
ShortMove is a Typescript type, if you are not using Typescript you don't need to worry about that and can remove it.
If you ARE using typescript and they do not show up you should made sure that in addition to installing the Library from with npm install chess.js you also installed the types by running:
npm install -D #types/chess.js
from the commandline
That command comes from the instalation instructions here:
https://github.com/jhlywa/chess.js/blob/master/README.md

React-navigation installation error(following official docs). Unable to resolve module #react-navigation/native-stack

There are a bunch of questions already covering this exact error, but I've been through all of them, and so far none of the answers have worked for me. Platform is MacOS
Here is the error:
Steps to reproduce
(Following official React Navigation docs https://reactnavigation.org/docs/getting-started/):
Create a new expo managed app
expo init my-app
Navigate to directory
Start the app
expo start
**** At this point everything starts and works correctly ****
Install reactnavigation(follow official docs https://reactnavigation.org/docs/getting-started/ )
yarn add #react-navigation/native
Install dependencies
expo install react-native-screens react-native-safe-area-context
Wrap the code with a Navigation container (per the docs)
Start the app
expo start
**** App no longer works. Fails with the error I posted earlier ****
Things I've tried that haven't worked
The instructions that the error message provides (though I skip step 1, as I don't have watchman watches installed). Main thing here that I would expect to work is the deletion of node_modules and yarn.lock, but no luck :(. Same with deleting cache
using yarn add to add the dependencies instead of expo install
using npm to install everything
updating expo-sdk (I'm already on latest)
reinstalling everything
So, I actually was able to answer my own question in the process of writing it. I often do this, as I make sure to spend several hours trying to debug in the process of writing the question and making sure I've covered everything I can think to try.
Not sure of official self answer etiquette, but this was a pretty frustrating error for me, so I figure I'll post what worked for me here in case it can help anyone else in the future.
Answer:
The issue for me had nothing to do with the code or app itself, but rather the IOS simulator. Force quitting the simulator and restarting resolved the error. It seems that simply ctrl^c -> expo start -> i -> r is not enough to clear the internal state of the simulator.
There was actually even a clue in the error message itself, but I missed it because the error looked so similar to the one I was expecting. The clue was in the name of the module it was unable to resolve "#react-navigation/native-stack". In my reproduction steps, I was only using the NavigationContainer, as I was trying to get that working before installing any of the Navigators and trying to use those.
Why was it trying to resolve the native-stack navigator? I'm not 100% sure, but my guess is that there was some kind of cache in the simulator that wasn't being cleared properly. Why do I think that?
This problem started with me trying to use a native-stack navigator in another app I'm working on. I quickly ran into this error, and figured the best way to debug would be to spin up a brand new blank app and try to get ReactNavigation working in there. I started with just navigation package and NavigationContainer itself, and once I couldn't even get that working, I assumed the problem was with the base react-navigation package installation. I failed to notice that it was still trying to resolve that native-stack navigator.

Unable to Add React to existing Rails app

I've setup a rails app all good, server runs fine etc, now I need to add React to it.
I see the command
rails webpack:install:react
appears to be the way everyone recommends but when I run this I get the following error:
rails aborted!
Don't know how to build task 'webpacker:install:react' (See the list of available
tasks with `rails --tasks`)
Did you mean? webpacker:install
So I run webpacker:install, alls good then try with :react again and the same errors generated, I've got react added in the package.json file and react-rails in the gem file. I've also run bundled since adding these.
I cant find an answer anywhere so whatever you've got I'll take.
Thank you.
Found the issue, the problem was that webpacker:install:react was removed from webpacker v6, moved to version 5.4.3 and the issues resolved.
More info here:
https://github.com/rails/webpacker/pull/2802/files#diff-8efe491b392a5a50e31b54660bbc0e7258e544e36d4e0b8a65e4cca93d39d18c
As the above answer states, this was removed. If you see a tutorial telling you to run rails webpack:install:react you can simply skip it if you've already run rails webpack:install. React now works "out of the box" and so you don't need to specify it.

Generating .d.ts file for react-dropdown-tree-select.js module

I am fairly new to react and typescript. I have included the dropdown tree select in my project but it is missing the index.d.ts file in the #types\react-dropdown-tree-select folder. I am not really sure how to generate or make one (not sure of the contents). I tried the dts-gen, but it gives an error as "Couldn't load module "react-dropdown-tree-select". Please install it globally (npm install -g react-dropdown-tree-select) and try again." Even when I have installed it globally.
react-dropdown-tree-select author here.
Currently react-dropdown-tree-select doesn't have any typings, simply because no one ever created them. However, I can see how this can be important for TS users. If you'd like to submit a PR or collaborate on creating typings, I'd be glad to answer any questions you may have.
Thanks for your interest in this component.

How do i install Slick-carousel in Atom

i've never used packages before and to be frank i really have no idea how they work, i found this package that i wanted to install. Now i got a zip-file and i don't know what to do with it. Tried unzipping it into the atom packages folder but it gives me an error "Cannot find module 'Jquery'. The github page says alot of stuff but i really don't know what it means.
https://github.com/kenwheeler/slick
Some help would be great, feels like this should be far easier than i believe it is.

Resources