Solution to “npm run storybook-web” not working on Windows

Real time problem SOLVED !!!!!!

Agenda: Issue resolving
Issue: NPM and Node work perfectly for all projects but for ReactXP on Windows it gives errors while the same code works fine on Unix/Linux Environment.

Explanation:
Usually, node_modules appear when “npm install” is run whether it ends with an error or goes smooth. It actually installs the dependencies. But seeing this error and “npm run storybook-web” not working and giving an error instead can be exhausting. Most people would try to sort the installation out to counter errors. What they usually do is uninstall NodeJS and NPM and then reinstall it, they end up getting nothing useful. What’s interesting is that sometimes it gives error while installing node_modules and sometimes it goes smooth but the main issue (“npm run storybook-web”) still remains there despite the smooth installation. It points that the issue lies with “npm run storybook-web” command.

Issue thought to be:

The common assumption is that the problem is with NodeJs and npm versions and their compatibilities. Most professionals would go on degrading and upgrading the versions of NodeJs and npm.

Solution:
You’ll notice the following error while running “npm run storybook-web”:

npm ERR ‘NODE_ENV’ is not recognized as an internal or external command.

Searching for the solution of this error on stackoverflow.com I found this:
for windows use & in between command also. Like,
“scripts”: {
“start”: “SET NODE_ENV=development & nodemon app/app.js”,
}
I went in my package.json file and in “scripts” section, added “&” between SET NODE-ENV command the way above and I got my storybook-web running.

It took me about 3 days were spent to get this solution.I hope it helps the newbies.

Leave a Reply