Problems updating to React 15.4.0 - reactjs

I'm getting this error with in all my files:
Module not found: Error: Cannot resolve module 'react/lib/ReactMount' in...
I'm using the latest version of react: 15.4.0.
webpack: 1.12.11
Any help?

One quick solution to this will be use npm to install reactjs.
npm install --save react react-dom
Don't use standalone react bundle.
More solutions can be provided if you post your webpack config file.

The problems seems to be located in react-hot-loader library.
As mentioned #gaereon in my react gitub post, apps should not rely on internal APIs. So, react-hot-loader is using ReactMount.
I asked to fix it, for now I will return to latest version of React.
UPDATE
I had the 1x version. I switched to 3x beta version and works fine.

Related

Installing an older version of Storybook

I am having an issue with Storybook 6.3 since it uses Webpack 5 and I am installing it on a clean create-react-app which uses Webpack 4.41.8.
I tried to update react webpack and all and still no luck. The problem started after I tried to add sass support for my storybook project, and went into dependency hell.
I just want to install an older version of Storybook like 5.3, how do I do that? Since Storybook uses npx sb init?
So in the end I found this to be the answer to all my problems (having latest Storybook and working sass support) that has been using the standard webpack-loaders as shown in the official Storybook docs, do not forget to import them and the entry .scss file in the root/.storybook/preview.js file e.g. import "!style-loader!css-loader!sass-loader!../stories/assets/main.scss"
You could downgrade storybook.
This is the official manual
If you'd like to downgrade to a stable version, manually edit the
package version numbers in your package.json and re-install.

Using React Dev Tools with Preact

I have just got preact-redux-example up and running, and now I am attempting to use Preact Dev Tools in my app.
Based on this post I assumed it was a case of adding
import 'preact/devtools'
into the entry point (app.js) file.
However, this yields the following error:
./src/components/app.js
Module not found: Error: Cannot resolve module 'preact/devtools'
Is there something else I need to install, or am I on the wrong track?
preact/devtools has landed in version 6.4.0, but the example project uses version 4.8.0. So you need to upgrade the preact version to be able to import it:
npm install --save preact#latest
Or if you're using yarn you can run:
yarn upgrade preact

Jest fails with error: Cannot find module 'react/lib/ReactComponentTreeHook'

I have installed Jest v17.0.3 in my react project.
When I run jest locally it works fine, but on the build server it fails with:
Error: Cannot find module 'react/lib/ReactComponentTreeHook' from 'ReactDebugTool.js'
Both machines are running node version 6.9.1 and npm version 4.0.2.
use same version of react and react-dom. My problem fixed after using this command
npm install --save react#15.4.0 react-dom#15.4.0
this problem specially occurs on react 15.4.0 above.
Can you check which version of React you are using? Is it the same on both servers? I would try removing node_modules and reinstalling the dependencies. The reason I am suggesting this is that in React v15.4.0 you cannot import private apis and it seems that ReactDebugTools.js is trying to import from react/lib/....
From the blogpost about React v15.4.0 (Link):
However, there is a possibility that you imported private APIs from react/lib/*, or that a package you rely on might use them. We would like to remind you that this was never supported, and that your apps should not rely on internal APIs. The React internals will keep changing as we work to make React better.
Hope this helps!
In the latest versions of react we often see this error as we have loaded 2 versions of react:
To make sure you have just 1 version, run the following in your terminal:
npm ls react-dom
npm ls react
Both the react and react-dom versions need to be same.
If any one of these returns more than 1 version then that's not supported. You have to then correct it in your corresponding package.json
I had the same issue and i removed the node_modules and ran npm install and it fixed the problem.

Material-ui response to breaking change in React 15.4.0? "Cannot resolve module 'react/lib/EventPluginHub'"

React v 15.4.0 was released this morning and seems to have included a change that broke react-tap-event-plugin v1.0.0 producing this error:
$ npm build
> myProject#0.1.47 build /.../myProject
> node scripts/build.js
Creating an optimized production build...
Failed to create a production build. Reason:
Module not found: Error: Cannot resolve module 'react/lib/EventPluginHub' in /.../myProject/node_modules/react-tap-event-plugin/src
(note: I cleaned up the output a little)
According to THIS react-tap-event issue log version 2.0.0 of react-tap-event fixes the build problem. However, material-ui is still using react-tap-event version 1.0.0. What are the options here? The only options I can think of are:
Downgrade react and other packages as described in the link above
Wait for Material-UI to upgrade to react-tap-event 2.0.0
Any other solutions here? I'm pretty much dead in the water if I wanted to use react 15.4.0, as far as I can tell.
Almost make sure you update the react-tap-event-plugin to the right version of react.
material-ui version 0.16.3 is released to address the problem.
I had the same problem. I resolved it by going through next steps:
- delete `"react": "{your-version}"` line from package.json;
- delete node_modules dir;
- run `npm i`;
- run `npm i react --save`.
in React 16.4 removes a lot of internals (#121) this plugin depends on and will break the plugin.
https://www.npmjs.com/package/react-tap-event-plugin
as solution with new release of React uninstall thia plugin and deleted any imports and uses from source Reaction Commerce: TypeError: require(...).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED is undefined
and
Is react-tap-event-plugin still needed in 2018?
i removed react-tap-event-plugin from my reactjs project. it work for me

Using npm on Meteor 1.3 + angular1 (bump!)

Edit note:
I am changing this question as I progress. Will continue to update.
I've upgraded my angular-meteor project (Meteor 1.2.1 + jade + ES6 js) to 1.3. The update was successful and everything works as before. I'd like to start using npm to install angular plugins as in:
meteor npm i <package>
As a first step, I've installed angular and angular-meteor:
meteor npm i angular --save
meteor npm i angular-meteor --save
then added:
import angular from 'angular';
import 'angular-meteor';
I've got a few missing packages errors on the server side, and fixed those by adding them using npm i <package> --save
Now I'm bumping against:
Error: Can't find npm module 'ecmascript'. Did you forget to call 'Npm.depends' in package.js within the 'modules-runtime' package?
W20160410-21:27:53.530(3)? (STDERR) at Object.Npm.require (/Users/user/work/myproj/.meteor/local/build/programs/server/boot.js:195:17)
Ideas?
Update
I assumed that adding ecmascript would fix it, but the error happens when it's installed. To be clear, I wasn't sure if to meteor add ecmascript or to meteor npm i ecmascript so tried both, separately and together. Nether fixed the above error.
That being said, meteor add ecmascript actually got ES6 errors to stop, so I know it's there and active
2nd-Update (3 weeks later)
Waiting and retrying the update after a couple of weeks solved it: I've run Meteor update then run the server, which in turn errored a few times about missing npm packages but after [meteor] npm install of those, everything worked like a charm. Problem solved!
In previous version of Meteor Angular we removed ecmascript if you're migrating, add it back
meteor add ecmascript
Here are the steps that worked for me:
1. meteor update
2. review the packages that did not upgrade and upgraded them. Specifically the ones shown bellow:
The following top-level dependencies were not updated to the very latest version available:
* angular 1.3.7 (1.3.10 is available)
* angular-meteor-auth 0.2.2 (1.0.2_1 is available)
Newer versions of the following indirect dependencies are available:
* angular-meteor-data 0.3.0 (1.3.10 is available)
* angular-templates 1.0.1 (1.0.2 is available)
* pbastowski:angular-babel#1.3.4
meteor npm init (and fill all details)
npm install --save angular angular-meteor
added the following import on app.js (main app file): import angular from 'angular';
(I added also import angularMeteor from 'angular-meteor';, but it does not seem to be necessary).
I received one strict-di error which I fixed by adding 'ngInject'; to that function (RoutingHandler).
That made my project work as before (no new npm packages, no extra imports).

Resources