Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

benjaminmosery
6,346 PointsCannot find module 'react' from 'Accordion.js'
After running my searchapp, accessing the searchapp command directory using "cd searchapp", and running a test module using "npm test", I get the following error:
> react-scripts test --env=jsdom
FAIL src\App.test.js
● Test suite failed to run
Cannot find module 'react' from 'Accordion.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:179:17)
at Object.<anonymous> (../node_modules/react-bootstrap/lib/Accordion.js:21:14)
My App.test.js file is as follows, for clarification:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
});
Why is the test not passing in Node's npm command prompt? Any help would be appreciated.
1 Answer

benjaminmosery
6,346 PointsI have react as a dependency in the package.json file:
{
"name": "searchapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}

Gustavo Winter
Courses Plus Student 27,382 PointsTry to delete your node_modules folder, and install all the packages again.
You will have to do the npm command at the main directory.
npm install
Tell me if the problem was solve
Gustavo Winter
Courses Plus Student 27,382 PointsGustavo Winter
Courses Plus Student 27,382 PointsDid you have React installed in your package.json ?