Vishal Tanna
Vishal Tanna

Reputation: 1305

Reactjs - Demo Application is not working

I am trying setup react new setup but it is give me below error

./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
Error: Cannot find module '@csstools/normalize.css'

can anyone suggest me to move forward

thanks in advance

Upvotes: 15

Views: 8436

Answers (6)

Thuvarahan Sivakumar
Thuvarahan Sivakumar

Reputation: 433

I'm able to solve the problem. The problem is that package-lock.json is pointing to the older packages.
To fix, uninstall an install the package again

Uninstall package

$ sudo npm remove csstools/normalize.css

After that, we have to install again

$ npm install csstools/normalize.css

(removing sudo from the npm install command)

Upvotes: 21

SHRIDHAR
SHRIDHAR

Reputation: 71

fixed issue by updating npm to latest version.

sudo npm install npm@latest -g

Upvotes: 0

Max Hudson
Max Hudson

Reputation: 10226

This worked for me (unfortunately a really annoying solution since it gets wiped whenever node_modules gets reinstalled), when recreating with npx create-react-app did not work.

  1. Go to react-app/node_modules/@csstools

  2. Change the name of the normalize.css folder into something else (ex. anormalize.css)

  3. Take the files from the folder and paste them into the @csstools folder

  4. Delete the anormalize.css folder

Source

Upvotes: 0

Hannibal
Hannibal

Reputation: 1

If you're getting this error, chances are that you haven't used npx to create the react app. You must have used -

create-react-app project_name

Delete the project folder and reinstall it using -

npx create-react-app project_name

It should work this time. npx is a tool for node packages, which also installs some third party packages that running create-react-app alone might not install, hence throws the error.

Upvotes: -1

Naoyuki Tai
Naoyuki Tai

Reputation: 443

I solve the same problem. The problem is that package-lock.json is pointing to the older packages. Not sure which package is but needs to be updated. The gist is that, you create a fresh reactapp, use your "package.json" to recreate "package-lock.json", and move it over back to your project. Do it AFTER you update the npm and clear the cache. Unfortunately, I didn't keep the exact sequence as I was trying to solve, following steps should be pretty close to what I did.

$ sudo npm cache clear --force
$ sudo npm install -g npm
$ cd <MYREACTAPPDIR>
$ npm install react@latest --save
$ cd ..
$ npx create-react-app tempapp
$ cp <MYREACTAPPDIR>/package.json tempapp/package.json
$ cd tempapp
$ npm install
$ cp package-lock.json ../<MYREACTAPPDIR>
$ cd ../<MYREACTAPPDIR>
$ rm -fr node_modules
$ npm install
$ npm run build

Upvotes: 0

Nishith H.M
Nishith H.M

Reputation: 21

rm -rf node_modules
npm cache clean --force
npm install

now try again to run your scripts, it should work

https://github.com/react-toolbox/react-toolbox-example/issues/28

Upvotes: 1

Related Questions