I'm writing code using WebStorm. Today I tryed to install redux-form and from that moment the code it's broken. Also if the yarn install goes well I i get this error into browser on localhost
C:/Users/WebstormProjects/.....reducer.ts
(7,40): Could not find a declaration file for module 'redux-form'. 'C:/Users/WebstormProjects.....index.js' implicitly has an 'any' type.
Try `npm install #types/redux-form` if it exists or add a new declaration (.d.ts) file containing `declare module 'redux-form';`
The code have no semantic error and I also installed as the error says npm install #types/redux-form but the situation it's the same. Can someone help me??
(Posted on behalf of the question author).
I solved the problem deleting the directory with node modules and do: npm install, installing the redux-form and later installing types for this component.
Related
I have a git repo that I'm supposed to launch with the command react-scripts start. When I run this command I get this response saying typescript cant be found:
react-scripts start
It looks like you're trying to use TypeScript but do not have typescript installed.
Please install typescript by running npm install typescript.
If you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files).
I have tried installing typescript in command prompt with npm i typescript, npm i -g typescript, yarn add typescript, yarn global add typescript, and "choco install typescript".
I am able to run typescript files, but still if I try to launch my program I get that error saying I dont have typescript installed.
If I just run tsc in my command prompt or powershell I get some error alerts that I have tried to solve but no luck yet:
tsc
src/App.tsx:12:5 - error TS2307: Cannot find module 'react/jsx-runtime' or its corresponding type declarations.
12 <UserAccountContext.Provider value={guestAccount}>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 <div className="App container">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
24 </div>
~~~~~~~~~~~~
25 </UserAccountContext.Provider>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/App.tsx:13:7 - error TS2339: Property 'div' does not exist on type 'JSX.IntrinsicElements'.
13 <div className="App container">
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/App.tsx:15:9 - error TS2339: Property 'div' does not exist on type 'JSX.IntrinsicElements'.
Is there some way I can ensure typescript is installed? Ive tried running the installation commands in both powershell and command prompt.
You can just simply install in your project by using yarn add typescript #types/node #types/react #types/react-dom #types/jest or npm install --save typescript #types/node #types/react #types/react-dom #types/jest.
If you have a problem with the scripts perhaps updating them will solve it, you can try this command: npm install react-scripts#latest
For further information you can check this links: Create React App and Typescript Docs
Also you may check frameworks that have native support to TS, like Next and Gatsby
i have installed fontawesome by following these steps by visiting their website.
npm i --save #fortawesome/fontawesome-svg-core
npm install --save #fortawesome/free-solid-svg-icons
npm install --save #fortawesome/react-fontawesome
and now am getting this error
./node_modules/react-scripts/node_modules/#pmmmwh/react-refresh-webpack-plugin/lib/runtime/RefreshUtils.js
Error: ENOENT: no such file or directory, open 'C:\Users\HP\Desktop\practice site\javascript\REACT\Codingworld\node_modules\react-scripts\node_modules#pmmmwh\react-refresh-webpack-plugin\lib\runtime\RefreshUtils.js'
Help me to solve my error
Please try this one. I hope to solve it. if it solves please comment on my answer.
install font-awesome for react
The error message says that it's looking for a file RefreshUtils.js in the directory C:\Users\HP\Desktop\practice site\javascript\REACT\Codingworld\node_modules\react-scripts\node_modules#pmmmwh\react-refresh-webpack-plugin\lib\runtime but doesn't find it.
This file is part of the npm package #pmmmwh/react-refresh-webpack-plugin.
It could be that you previously installed this package, or that this package is a dependency for another package you're using (e.g. react-scripts).
Your question doesn't include sufficient information, such as the content of your package.json file, and specifying which command is giving the error.
There could be various reasons causing the error:
Running the command from the wrong folder
In this case, navigate to the correct folder in your terminal, then run the command.
Issues in your dependencies
In this case, given that you have a package.json file in your project folder, reinstall all your dependencies:
Delete the node_modules folder and the package-lock.json file
Run npm cache clean
Run npm install
Given that you're running the command from the correct folder and your dependencies are up-to-date, the error should go away.
Every time I try running npm start on a new project I keep on getting this error. Does anyone know or have any idea how to fix this??
There might be a problem with the project dependency tree. It is
likely not a bug in Create React App, but something you need to fix
locally.
The react-scripts package provided by Create React App requires a
dependency:
"babel-jest": "^26.6.0"
Don't try to install it manually: your package manager does it
automatically. However, a different version of babel-jest was detected
higher up in the tree:
D:\node_modules\babel-jest (version: 24.9.0)
Manually installing incompatible versions is known to cause
hard-to-debug issues.
If you would prefer to ignore this check, add
SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That will
permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact
order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem. If this has
not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if D:\node_modules\babel-jest is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls babel-jest in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-jest.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file
in your project. That would permanently disable this preflight check
in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-)
We hope you find them helpful!
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR!
react-portfolio#0.1.0 start: react-scripts start npm ERR! Exit
status 1 npm ERR! npm ERR! Failed at the react-portfolio#0.1.0 start
script. npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\smaso\AppData\Roaming\npm-cache_logs\2021-01-26T22_50_48_484Z-debug.log
I also face this problem. Simple solution of this problem is:
1)create .env file.
2) add SKIP_PREFLIGHT_CHECK=true in the file.
3) npm start
If this fails to work, create a .env file in the root directory of your project and add the following line
SKIP_PREFLIGHT_CHECK=true
just go to your project's root directory and delete node_module folder and npm start your project.
Delete and redownload node modules and run application again
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if ./babel-jest is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls babel-jest in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-jest.
Seems like you created the react project using create-react-app and installed jest using the following command.
yarn add --dev jest babel-jest #babel/preset-env #babel/preset-react react-test-renderer
But in the documentation it says just to run the following command if you are using create-react-app
yarn add --dev react-test-renderer
[See the documentation][1]https://jestjs.io/docs/tutorial-react
This worked for me.
I used the following command to uninstall jest npm uninstall jest in the root project folder (not the client) and then used the react scripts start command npm start and it worked
removing jest.config.js and uninstall ts-jest solved my problem
I'm having an issue with the create-react-app command. I've followed the instructions twice, tried other solutions such as adding
"resolutions": {
"ajv": "6.8.1"
}
to the package.json file then uninstalling and reinstalling ajv#6.8.1. I've tried using yarn but ended up just starting it all over to use npm, just to get the same error. Most answers I am finding are a year or more old. any help is Appreciated!
Here is the error message..
npm start
scilenceapp#0.1.0 start C:\Users\chris\OneDrive\Documents\coding stuff\SciLence\ScilenceApp\scilenceapp
react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.42.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:
C:\Users\chris\node_modules\webpack (version: 4.41.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\Users\chris\node_modules\webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scilenceapp#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scilenceapp#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\chris\AppData\Roaming\npm-cache_logs\2020-07-27T21_42_25_489Z-debug.log
PS C:\Users\chris\OneDrive\Documents\coding stuff\SciLence\ScilenceApp\scilenceapp>
“C:\Users\chris\node_modules\webpack (version: 4.41.2)”
You may have to remove that file from your c drive. And run npm i again. I had the same issue with jest.
try also npm cache clean --force
Welcome,
I can't run Typescript all my day. I use Visual Studio Code. What I am doing is installing TS globally:
$ npm install -g typescript
Then when I check it:
$ tsc
I get that error in all cases:
bash: tsc: command not found
To that time I have tried following solutions:
Setting npm config:
$ npm config set prefix /usr/local
What I get after npm root -g is:
C:\Program Files\Git\usr\local\node_modules
Setting npm config by relative way to get (And I get it):
C:\usr\local\node_modules
Setting .bash_profile:
export PATH=/usr/local/share/npm/bin:$PATH
Setting .bashrc with PATH also...
Installing Typecript as dev dependency also don't work.
Other small solutions that I even don't remember.
Please for help. I can provide more information that you need - just say what.
Tried every known solution
Will definitely work:
Uninstall nodejs
Install nodejs (make sure you ask it to set PATH for you)
npm install typescript -g
🎊🌹