Module Not Found from git url dependency

4.5k views Asked by At

I have forked react-flexbox-grid to add support for hidden-columns (this is my first time contributing) but I'm unable to include the package in my project.

Per the Docs: Git Urls as Dependencies, I put the following in my package.json:

    "react-flexbox-grid": "falieson/react-flexbox-grid#hidden-columns",

After running npm i, I see that npm fetched and had no errors installing the package.

├── [email protected] ├── [email protected] (git://github.com/falieson/react-flexbox-grid.git#f8e9e9053430b619f4c7fd79b90ccd4f44d6a05c) ├── [email protected]

But when I start the server meteor:webpack complains:

ERROR in ./imports/ui/Home/index.jsx Module not found: Error: Cannot resolve module 'react-flexbox-grid' in /Users/falieson/Code/planetx-boilerplate/imports/ui/Home

I haven't changed anything on the index.jsx

import {Grid, Row, Col} from 'react-flexbox-grid';

Here's my meteor webpack config:

{
 "css": {
   "module": true
 },
 "module": {
   "loaders": [
     {
       "test": "/\\.css$/",
       "loader": "style!css?modules",
       "include": "/flexboxgrid/"
     }
   ]
 }
}
3

There are 3 answers

0
Lucas Zientek On BEST ANSWER

The issue is that this repo need to be build, the package.json is refering to the ./lib/index.js file but it doesn't exists in the repo (only src folder).

You can build it localy with:

npm run compile

and force add and push the ./lib folder to your git repo.

1
rsp On

Shouldn't it be this:

"react-flexbox-grid": "falieson/react-flexbox-grid#hidden-columns",

without git in package.json?

Normally I would say that it may be a private module which you can install because you have permissions to do that but in other environment it can't be accessed, because GitHub gives 404 for private repos if you don't have permissions to access them. Or that you may not have a branch or rag called "hidden-columns" but here it seems that you have that branch and that the module is public so this is not the problem.

0
m-farhan On
  1. Make sure your compiled files are in the commit.
  2. Make sure git ignore is updated to not ignore you compiled files.
  3. npm rm -rf ./node_modules/xxxx if module is already installed
  4. npm install --save-dev https://gitlab.com/m_farhan/xxxxx.git#master
  5. make sure you build your code before pushing it to repo.
  6. npm xxxxx update your project.