Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module '/home/aziz/Desktop/testapp/node_modules/react-icons/lib'. Please verify that the package.json has a valid "main" entry #283

Closed
azizcoban opened this issue Jan 15, 2020 · 1 comment

Comments

@azizcoban
Copy link

azizcoban commented Jan 15, 2020

When I trying to compile the app everytime I get this error even if all the packages are updated and exist. How can I solve this problem ?

Here is my component

import React from 'react'
import styled from 'styled-components'
import Link from 'next/link'
import { IconContext } from 'react-icons';
import {FiGrid} from 'react-icons/fi'
import {FaShoppingBag, FaWallet, FaUser} from 'react-icons/fa'
import {IoLogoGameControllerB} from 'react-icons/io'

const ListContainer = styled.ul `
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: rgb(28,28,30);
`;

const ListItem = styled.li `
    display: inline-block;
    padding: 30px;
   
`;


const FooterMenu = () => {
    return(
        <IconContext.Provider value = {{color: "#8e8e93", size: "2.5em" }}>
        <ListContainer>
            <ListItem>
                <Link href="/games" as="/games">
                        <FiGrid height = '21em' width = '21em'/>
                </Link>
            </ListItem>
            <ListItem>
                <Link href="/games" as="/games">
                        <FaShoppingBag/>
                </Link>
            </ListItem>
            <ListItem>
                <Link href="/games" as="/games">
                        <IoLogoGameControllerB/>
                </Link>
            </ListItem>
            <ListItem>
                <Link href="/games" as="/games">
                        <FaWallet/>
                </Link>
            </ListItem>
            <ListItem>
                <Link href="/games" as="/games">
                        <FaUser/>
                </Link>
            </ListItem>
        </ListContainer>
        </IconContext.Provider>
    )
}

export default FooterMenu;

My package.json file

{
  "name": "custom-server-express",
  "version": "1.0.0",
  "scripts": {
    "dev": "node server.js",
    "build": "next build",
    "start": "cross-env NODE_ENV=production node server.js"
  },
  "dependencies": {
    "@zeit/next-css": "^1.0.1",
    "axios": "^0.19.1",
    "babel-plugin-styled-components": "^1.10.6",
    "bootstrap": "^4.4.1",
    "cross-env": "^5.2.0",
    "express": "^4.14.0",
    "express-session": "^1.17.0",
    "imagemin-optipng": "^7.1.0",
    "next": "^9.1.6",
    "next-compose-plugins": "^2.2.0",
    "next-images": "^1.3.0",
    "next-optimized-images": "^2.5.4",
    "react": "^16.12.0",
    "react-bootstrap": "^1.0.0-beta.16",
    "react-dom": "^16.12.0",
    "react-icons": "^3.8.0",
    "react-responsive-carousel": "^3.1.51",
    "styled-components": "^4.4.1"
  }
}

Additional Note
I always get this error when I added the IconContext.Provider tag.

Errors

Error: Cannot find module '/home/aziz/Desktop/testapp/node_modules/react-icons/lib'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:297:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:528:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:784:27)
    at Function.Module._load (internal/modules/cjs/loader.js:690:27)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.react-icons (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:2515:18)
    at __webpack_require__ (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:23:31)
    at Module../pages/components/FooterMenu.js (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:2070:69)
    at __webpack_require__ (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:23:31)
    at Module../pages/HomePageContainer.js (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:1925:80)
    at __webpack_require__ (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:23:31)
    at Module../pages/index.js (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:2276:76)
    at __webpack_require__ (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:23:31)
    at Object.3 (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:2338:18)
    at __webpack_require__ (/home/aziz/Desktop/testapp/.next/server/static/development/pages/index.js:23:31) {
  code: 'MODULE_NOT_FOUND',
  path: '/home/aziz/Desktop/testapp/node_modules/react-icons/package.json',
  requestPath: 'react-icons'
}

@kamijin-fanta
Copy link
Member

Discussed in #509

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants