Failed to load plugin 'import' declared in 'package.json » eslint-config-react-app': Cannot find module 'typescript/package.json' - reactjs

ERROR in [eslint] Failed to load plugin 'import' declared in 'package.json » eslint-config-react-app': Cannot find module 'typescript/package.json'
Require stack:
- C:\Users\USER\Desktop\bitcamp-homework_1\homework1\node_modules\eslint-plugin-import\lib\rules\no-duplicates.js
- C:\Users\USER\Desktop\bitcamp-homework_1\homework1\node_modules\eslint-plugin-import\lib\index.js
- C:\Users\USER\Desktop\bitcamp-homework_1\homework1\node_modules\#eslint\eslintrc\dist\eslintrc.cjs
I tried to create new react app with "npx create-react-app", after running npm start, this error appeared. I dont even using ts. what can I do?
I try reinstall but wont work.
Sometimes it runs without error.
[UPDATE] as i found out that was directory problem. (file in file)

add :
{
"eslint.workingDirectories": ["./front", "./back", "./shared"]
}
to settings.json

Related

Module not found: Error: Can't resolve 'fs' in dotenv - upgrading to react 17

I recently upgraded my react app - initially created with CRA, but i'm getting an error i can't figure out how to solve :
ERROR in ./node_modules/dotenv/lib/main.js 24:11-24
Module not found: Error: Can't resolve 'fs' in '/project/frontend-react/node_modules/dotenv/lib'
EDIT:
what am I doing to get this error : npm start
where do I get that error : in the browser, the app is not loading at all
and in regard to the error it's really all i'm getting
Any help welcome, as i'm lost despite quiet a lot of research...
Well, I was using dotenv on the app, removing it cleared the error...

react-dropdown-input Module not found: Error

I'm trying to use the react-dropdown-input library in my react project.
(https://www.npmjs.com/package/react-dropdown-input)
I used npm i react-dropdown-input and it installed.
But when I run my project, I get this errors:
ERROR in ./~/react-dropdown-input/index.js Module not found: Error: Can't resolve 'react/addons' in 'path\node_modules\react-dropdown-input'
And this one too
ERROR in ./~/react-dropdown-input/index.js
Module not found: Error: Can't resolve 'react/lib/joinClasses' in 'path\node_modules\react-dropdown-input'
I also tried to run this command: npm install #types/react-dropdown-input but that library doesn't exists.
This is my import line:
import DropdownInput from "react-dropdown-input";
In my code it also says this:
Could not find a declaration file for module 'react-dropdown-input'.
Does anyone knows why this is happening and how to solve this?
Tested on npm#6.4.1, node#10.13.0. It fails.
I tried cloning it. Looks like library in not maintained. Its last commit was around 5 years back.
You can have a look at React Autosuggest. Its provides exact features you are looking for.
Hope this helps.

failed to compile React projects

I am busy with a project of React and
When I want run a browser I get this error.
./src/Components/ui/icons.js
Module not found: Can't resolve './src/Resources/images/logos/manchester_city_logo' in 'C:\Users\Daniel\Desktop\mancity\src\Components\ui'
This error occurred during the build time and cannot be dismissed.
I made sure of correct names of folders. Is it a npm webpack?
You are most probably referring to a non-existed media file or using wrong file extension when importing manchester_city_logo (probably in icons.js)
Doublecheck the source path for desired media file in icons.js

Module not found: Can't resolve './AppRoutes'

I'm following this react workshop:
https://github.com/spietrek/workshop.reactjs.1/blob/master/presentation/Introduction%20to%20ReactJS%20Workshop.pdf
I'm following all the code but I'm getting an error:
Module not found: Can't resolve './AppRoutes'...
Here's the editable project url:
https://stackblitz.com/edit/react-project
I'm at pg 17/27
You have put a space before the name of the file AppRoutes.js like <space>AppRoutes.js.
You have to remove the space to fix that error.
After fixing this also in you project there are some errors due to Fragment. I fixed that by updating react and react-dom packages to version 16.2.0.
This is a working fork of you project.
If AppRoutes is a .jsx file you have to load it with the .jsx file extension. Like ./AppRoutes.jsx

ERROR in ./~/react-tap-event-plugin/src/injectTapEventPlugin.js

React noob here. Trying to clone and run https://github.com/strangebnb/react-airbnb
I clone. run npm install. Then webpack but I get
ERROR in ./~/react-tap-event-plugin/src/injectTapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPluginHub' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
# ./~/react-tap-event-plugin/src/injectTapEventPlugin.js 23:2-37
ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventConstants' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
# ./~/react-tap-event-plugin/src/TapEventPlugin.js 22:21-56
ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPluginUtils' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
# ./~/react-tap-event-plugin/src/TapEventPlugin.js 23:23-60
ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/EventPropagators' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
# ./~/react-tap-event-plugin/src/TapEventPlugin.js 24:23-60
ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/SyntheticUIEvent' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
# ./~/react-tap-event-plugin/src/TapEventPlugin.js 25:23-60
ERROR in ./~/react-tap-event-plugin/src/TapEventPlugin.js
Module not found: Error: Cannot resolve module 'react/lib/ViewportMetrics' in /Users/thomas/tom/node_modules/react-tap-event-plugin/src
# ./~/react-tap-event-plugin/src/TapEventPlugin.js 27:22-58
ERROR in ./~/react-portal/build/portal.js
Module not found: Error: Cannot resolve module 'react/lib/CSSPropertyOperations' in /Users/thomas/tom/node_modules/react-portal/build
# ./~/react-portal/build/portal.js 17:29-71
I found https://github.com/thereactivestack/meteor-webpack/issues/21 (I see this is very recent, read: yesterday), and after messing around with my packages.json, changing react, react-dom, material-ui version numbers and running npm i --save react-tap-event-plugin, I got down to 'only' 1 error message
ERROR in ./~/react-portal/build/portal.js
Module not found: Error: Cannot resolve module 'react/lib/CSSPropertyOperations' in /Users/thomas/react-airbnb/node_modules/react-portal/build
# ./~/react-portal/build/portal.js 17:29-71
I'm pretty new and I'm not sure how to go about fixing this. Any hints greatly welcomed.
Thanks
Due to update in React, react-tap-event-plugin breaks
Change react-tap-event-plugin to ^2.0.0 in your package.json if using react version ^15.4.0.
I forked that repo and fixed this issue in my repo. Also, sent pull request to the owner of original repo. Here's link to my forked repo:
https://github.com/pankajvishwani/react-airbnb
If you don't want to clone my repo, you can add the following in webpack.config.js:
var reactDomLibPath = path.join(__dirname, "./node_modules/react-dom/lib");
var alias = {};
["EventPluginHub", "EventConstants", "EventPluginUtils", "EventPropagators",
"SyntheticUIEvent", "CSSPropertyOperations", "ViewportMetrics"].forEach(function(filename){
alias["react/lib/"+filename] = path.join(__dirname, "./node_modules/react-dom/lib", filename);
});
module.exports = {
...
resolve: {alias: alias},
...
}
UPDATE: As of React 16 the react-tap-event-plugin is deprecated and no longer required https://www.npmjs.com/package/react-tap-event-plugin
Old solution redundant as of React 16
Updating the react tap event plugin to over 2.0.1 will fix your issue if you're using React 15.4.0.
A new React version has been released (https://github.com/facebook/react/blob/master/CHANGELOG.md), and I read recently that there have been big changes where react-dom still secretly lived on in the react package but is now being removed. If you read 15.4.0, the first point: 'React package and browser build no longer "secretly" includes React DOM. (#sebmarkbage in #7164 and #7168)'
Also reading the tap event plugins npm docs: Only the latest tap event plugin (v2.0.1 currently) supports React 15.4+. https://www.npmjs.com/package/react-tap-event-plugin
Check the version of React and react-tap-event-plugin.
npm list --depth=0
In the short term, you could fix React to a specific earlier version.
If your package.json file contains something like:
"react": "^15.3.2",
in the dependencies section, you could change it to say
"react": "=15.3.2”,
For react 16+ react-tap-event-plugin is not required anymore:
react-tap-event-plugin

Resources