Why do I keep getting this error every time I try to use 'create-react-app react-hello' in my terminal - reactjs

I got this error
create-react-app : File C:\Users\Username\AppData\Roaming\npm\create-react-app.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170
after running this command;
create-react-app react-hello
I am just trying to understand what I should do to make it work because when I use
npx create-react-app react-hello
it's working perfectly.
can I make sure that I do not get this error when I run the command?

Related

Why is the create-react-app command not working?

Wanted to create a new react app, and ran both npx create-react-app and init react-app command in my Mac terminal but it's not working.
Tried a couple of times, but sometimes the folder is created with a package.json file only. Then everything stopped downloading. What could be the issue?
Screenshot of the output in the terminal:
According to your screenshot, there is no problem when you initialize your react project.
I think your local network may not be good enough. To create a react app, you need to install many third-party nodes_modules then cause mistakes.
Therefore, you can try to change the npm source, such as taobao( https://registry.npm.taobao.org )
npm config set registry xxx
And then use the craete-react-app to initialize the app.

How can I run Eslint only on changed lines of code

I want to run eslint on my react project in gitlab pipelines. This linting should run only on the changed lines of code but not on the whole file.
I am aware that we can run on the whole file but this could be a costly work when its a legacy code.
I tried eslint-diff its giving error as /usr/bin/env: node --harmony in gitlab but works fine in local

ReactJs Compiling Issue: immer.esm.js is not found

I am creating an reactJS application where I am using react-redux for state management. Few days back it was working fine but now I am getting below error at the time of compilation process:
Failed to compile.
./node_modules/#reduxjs/toolkit/node_modules/immer/dist/immer.esm.js
Error: ENOENT: no such file or directory, open 'root_directory\node_modules\#reduxjs\toolkit\node_modules\immer\dist\immer.esm.js'
I had setup react project using "create-react-app" command. After setting up, I have got few commands that I can use to run application. So, I am getting above issue while running below command:
npm run start
I have also tried to fix this issue after deleting package-lock.json file and then run npm install but still getting same error.
Can someone please guide me what has done wrongly and why this error arrived suddendly.
Thanks in advance

Yarn start fails with Unexpected identifier without details

I am trying to start up a react app. After cloning the code from github, running yarn install I ran yarn start and got the following error:
yarn run v1.22.10
$ cross-env HTTPS=true react-scripts start
Unexpected identifier
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The authors of the app don't know what might be wrong (it's working for them). I tried creating another app with create react app and that started up fine for me. I am not sure where to start looking as there is no indication as to where the "unexpected identifier" might be located or what it might be. Any ideas on what I might want to check or try? I am on MacOS Catalina.
I figured it out eventually. I tried running build and it failed on syntax error in one of the .js files (a missing comma). Once that was fixed the start ran too. If the start command returned the same informative error the build did it would have saved me hours :)

React start npm doesn't work - error event occured

I'm trying to start a new react environment using npx command.
While the npx is working and the directory is formed, when I try to start it won't work (using npm start).
This is the error I'm getting:
Here's a snapshot of the error I'm receiving:
Any idea what I need to do?
I've tried to re-install node.js to its latest version and try to change minor things in the package.js file.

Resources