Error follow storybook steps to create a libary with react - node.js

I'm try to create my libary follow this steps on Storybook' site:
npx create-react-app taskbox
cd taskbox
npx -p #storybook/cli sb init
When I run "npm start" the app works fine, but when I run "npm run storybook" I'm given this error on terminal:
Terminal error
I'm using node 16.13.1
Help me please.
UPDATE
A better image about the error

From this post it seems that the following tactics worked:
npm i --save-dev #storybook/react
npm i -D #storybook/cli
Some also say you need to re install your node modules using:
npm install
and then using this instead after:
npm start-storybook
it seems like the tech has some faults and the bulk of the people said :
I kind of solved the issue. I think the issue was due to the file system. I restarted my system and then again reinstalled storybook. Worked like a charm.

Related

"vite is not recognized ..." on "npm run dev"

I'm using Node.js and npm for the first time, I'm trying to get Vite working, following the tutorials and documentation. But every time I run into the problem 'vite' is not recognized as an internal or external command, operable program or batch file. I have been trying to find a solution for 4 hours now but with no results.
I tried restarting pc, reinstalling node.js, several procedures to create vite project but in vain. I suppose it's my beginner's mistake, but I really don't know what to do anymore.
Commands and responses I run when I try to create a vite project:
npm create vite#latest
>> my-portfolio >> vanilla & vanilla
cd my-portfolio
npm install >>resp: up to date, audited 1 package in 21s found 0 vulnerabilities
npm run dev
resp:
> my-portfolio#0.0.0 dev
> vite
'vite' is not recognized as an internal or external command,
operable program or batch file.
try to install the packages to make it work
npm install or npm i
For this error use the following command on your terminal in the present working directory of the project
npm install
npm run dev
first, try to install a node package manager and then run npm run dev hope it will work
yarn add vite
on project folder to add vite,
and run
npm run dev
again.
remember to update your node version to 18, LTS from 17 might not support this installation.
update:
I try to fresh install again my Laravel 9.19, since i had update my node to version 18, npm install & npm run dev just work fine without yarn.
According to documentation https://vitejs.dev/guide/#community-templates
npm install
npm run dev
npx vite build
I found myself in the same situation.
The problem is vite.cmd is not in the system or user PATH variable, so it cannot be found when it is executed from your project folder.
To fix it, you should temporarily add the folder where vite.cmd is in your PATH variable (either for the entire system or your user). I recommend adding it just for your user, and keep in mind you should probably remove it after you stop working on that project, because this could affect future projects using the same build tools.
To do this:
My PC > Properties > Advanced system settings > Click on Environment Variables (alternatively just use the start button and begin typing Environment, you should get a direct link)
On "User variables" find "Path" and edit it.
Add a new entry for the folder where vite.cmd is. Example "C:\dev\reactplayground\firsttest\test01\node_modules.bin" Check your project folder to find the right path.
Make sure your close and open your console for this change to affect.
Go back to your project root folder and run "vite build", it should work now.
for me I've:
1 - excuted yarn add vite
2- and then npm install
work fine !
For me I had a project I created on one computer and it had this in devDependencies:
"vite": "^3.1.0"
I did pnpm install and it reported everything was fine, but I was getting the error. I ran pnpm install vite and it installed it again with this:
"vite": "^3.1.8"
After that it worked fine. So try using npm, yarn, or pnpm to install the vite package again and see if that works.
try npm install
then npm run build
Recently faced this error and I run
npm install
npm run dev
then the output was
VITE v3.2.4 ready in 1913 ms
THAT'S COOL 😎😎😎
reference LINK
You need Node version 15 or higher, I had the same problem because I was using an older version of it.
Needs to install all the packages in package.json and run again
npm i
npm run dev
For me this worked:
I changed NODE_ENV environment variable to development ( earlier it was production - which should not be the case, as dev-dependencies won't get installed by npm install or yarn )
Here is what to make sure before running npm install or yarn:
Make sure `NODE_ENV` environment variable is not set to `production` if you running locally for dev purpose.
'vite' is not recognized as an internal or external command, operable program or batch file.
> vite
'vite' is not recognized as an internal or external command,
operable program or batch file.
try to install the packages to make it work
npm install or npm i
The following works just fine!
npx vite build
npm i
npm run dev
I had the same challenge and I was finding the error
create-vite : command not found
I resolved by running the command:
npm i create-vite
From there you can continue with running the command:
npm create vite#latest
Reference:
https://www.npmjs.com/package/create-vite
npm install or npm i
helps with issue of 'vite' is not recognized
After I tried npm install
i could run the npm run dev after and it showed me the localhost

here is problem for installing the styled-components from npm?

here is problem installing styled-components with npm install. please anyone help for the same or anyother way for install styled-components
I used command:
npm i styled-components -g
But it is not working for me
so please is here anyother way for same and why is not installing for me what can be problem.
Can you please remove node modules and try installing the same again using yarn this time?
If it is still not working please add more info about your question.
I use the command without the -g and it works for me.
npm i styled-components
The "npm install styled-components" works fine... just change the directory to the name of your react-app. for instance, if the name of your react app is "my-project", just type "cd my-project" into the terminal or command prompt. Then run "npm install styled-components".
It worked just fine.
In my own case, The directory was
PS C:\Users\user\Desktop\poop>
all I did was to add "cd me" in front of PS C:\Users\user\Desktop\poop>
because "me" was the name of my create-react-app project
after the above step, you now have PS C:\Users\user\Desktop\poop\me>
Then run npm install styled-components
it would work

NPX create-react-app terminal tells me node is not installed but it is

At the risk of looking like a complete idiot, why doesn't npx create-react-app my-app work for me? I have node and npm installed and updated, both in my path (as far as I can tell). When I type node -v and npm -v it works perfectly fine, gives me the version numbers, and I can use them just fine, but I get '"node"' is not recognized as an internal or external command,
operable program or batch file. from the terminal when I try the create-react-app statement. Everything else I've found on the internet tries to say by adding it to the path it will work, but I must be missing something.
By the way, I'm using windows with GitBash.
Thanks in advance.
First step:
npm cache clean --force
Second step:
npm install -g create-react-app
Third step:
Once installation successful, try running
npx create-react-app my-app

npm and other modules commands not working

Note: I am on Windows 10 64 bit running the latest LTS Node build.
It all started when I tried running the command npm i -g create-react-app and I get a message saying that npm is not a command.
I checked my PATH and I believe I have the proper directories in there.
I navigated to the directory of npm and tried running the command again, but it still didn't work. I found that the command npm.cmd worked in any directory. So tried running npm.cmd i -g create-react-app and that worked! I also had to use the the command create-react-app.cmd my-app, instead of create-react-app my-app. I thought I was set and I could just use those .cmd commands for the things I needed to do; however, when I tried to run the command create-react-app.cmd my-app and got this as a result:
I have looked in the file that is ran when using this command create-react-app.cmd my-app and there is no sign of npm being called. Turns out Node is being called in that file with the command below. I know this because when I run it by itself and I get the same output to the console seen in the previous image.
"node" "C:\Users\Allen\AppData\Roaming\npm\\node_modules\create-react-app\index.js" my-app
it was called in the create-react-app.cmd file like this "%_prog%" "%dp0%\node_modules\create-react-app\index.js" %*
I am at a loss. I could continue down this rabbit hole and try and find the node file that is calling npm and change it to npm.cmd but I would rather find a way to get the npm and create-react-app commands working as they are suppose to. At the very least I can just spin up a VM and work in that. It is just annoying that I can't get Node to work properly for me.
Use the command npx create-react-app my-app this will help you create react projects.
Also check the documentation : https://reactjs.org/
First check that you have npm installed on your machine and the version. You can just type npm version. Since npm version 5.2.0 npx is pre-bundled with npm, which is a CLI tool whose purpose is to make it easy to install and manage dependencies hosted in the npm registry. So try using npx create-react-app app-name. You can confirm that you are able to use npx by running which npx. If it is not available then you can install it by running npm install -g npx.

Npm start doesnt work after I create a react app

I'm following a youtube react tutorial and what I did was npx create-react-app my-app Once this was done I cd'ed into my-app and tried to npm start like the tutorial showed. I got an error saying
-npm ERR! missing script: start
I also saw that the person in the tutorial had a public and a source folder. I only have the node_modules folder and package-lock.json and package.json. Why am I missing the public and source folders and why cant I npm start?
I had the same issue and solved it running : npm uninstall -g create-react-app.
Thanks to the -g (aka 'global' attribute) you can run this terminal command no matter the directory you find yourself.
Then go in the directory you would like to find your project and run npx create-react-app my-app again!

Resources