Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module 'classnames'

I am getting the following error when I try and run grunt on a react project

$ grunt server Running "browserify:dist" (browserify) task

Error: Cannot find module 'classnames' from 'd:\wamp\www\react1\app\assets\js \components' Warning: Error running grunt-browserify. Use --force to continue.

Aborted due to warnings.

like image 822
The Old County Avatar asked May 16 '16 19:05

The Old County


2 Answers

You should post your package.json file, and the code of which file is trying to pull class names. That said it sounds like you're simply missing a dependency.

npm install classnames --save

Will add it to your package.json file and install it in node_modules. Re-run your grunt server after installing or updating any npm packages.

like image 116
agmcleod Avatar answered Nov 05 '22 09:11

agmcleod


First, install it with npm install classnames. In Windows, everything will be fine if you write

import classNames from 'classnames'

but in Linux, I got this error that 'classnames' is not defined... and the problem was the capital letter I wrote 'classNames' instead of 'classnames' for module import, so consider that it might solve your problem.

like image 27
Amir2mi Avatar answered Nov 05 '22 08:11

Amir2mi