Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

NPM package is broken when installing from a github url #20

Closed
yantakus opened this issue Aug 27, 2015 · 12 comments
Closed

NPM package is broken when installing from a github url #20

yantakus opened this issue Aug 27, 2015 · 12 comments

Comments

@yantakus
Copy link
Contributor

Installed the package via npm. When trying to import it:

import { Button } from 'react-mdl';

I get the following errors:

ERROR in ./~/react-mdl/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/Spinner in G:\findx\node_modules\react-mdl
 @ ./~/react-mdl/index.js 42:13-37

ERROR in ./~/react-mdl/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/Switch in G:\findx\node_modules\react-mdl
 @ ./~/react-mdl/index.js 43:12-35

ERROR in ./~/react-mdl/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/Textfield in G:\findx\node_modules\react-mdl
 @ ./~/react-mdl/index.js 46:15-41

ERROR in ./~/react-mdl/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./lib/Tooltip in G:\findx\node_modules\react-mdl
 @ ./~/react-mdl/index.js 47:13-37

There's no lib folder in the package directory:

screenshot_1

@tleunen
Copy link
Owner

tleunen commented Aug 27, 2015

The lib folder is missing your your hierarchy.. That's weird! I'll take a look.

@tleunen tleunen added the bug label Aug 27, 2015
@tleunen
Copy link
Owner

tleunen commented Aug 27, 2015

Not sure why you end up without the lib folder, but have you tried a clean install?
On my side, it seems to work fine.
screen shot 2015-08-27 at 9 28 20 am

@yantakus
Copy link
Contributor Author

Maybe the problem occurs because I install the package from my fork at github:

"react-mdl": "git://github.com/web2style/react-mdl.git#master",

And I can't try to install it from npm because it's version doesn't include my pull request (yet, I think) because of react version conflict.

@darkyen
Copy link
Contributor

darkyen commented Aug 27, 2015

@web2style do yo run the buildscript after you install ?

@yantakus
Copy link
Contributor Author

No. There's nothing about it in the README.

@tleunen
Copy link
Owner

tleunen commented Aug 27, 2015

Because you're getting the files from github, you actually don't have the compiled files. Therefore, you have to compile the files yourself with npm run compile in the react-mdl directory.

The compiled files are only pushed on NPM when a new version is published.

@tleunen tleunen closed this as completed Aug 27, 2015
@tleunen tleunen removed the bug label Aug 27, 2015
@yantakus
Copy link
Contributor Author

When installing from github, there's no src directory either. So npm run compile returns src doesn't exist error.

@tleunen
Copy link
Owner

tleunen commented Aug 28, 2015

Hmm.. Not sure how to fix this thing. Maybe someone has an idea?
I don't want to put the src folder on npm, but because of that it doesn't seem to get fetched when we install it from a github url.

I'll reopen, maybe someone can help here.

@tleunen tleunen reopened this Aug 28, 2015
@tleunen tleunen changed the title NPM package is broken NPM package is broken when installing from a github url Aug 28, 2015
@darkyen
Copy link
Contributor

darkyen commented Aug 28, 2015

How about registering a browserify transform ?! So that browserify compiles
this from src ? (For gh purposes only)
On Aug 28, 2015 8:34 PM, "Tommy" notifications@github.com wrote:

Reopened #20 #20.


Reply to this email directly or view it on GitHub
#20 (comment).

@slybridges
Copy link
Contributor

Any reason why you don't want to include the sources on NPM @tleunen ?
I actually find it's easier to have the sources when investigating a potential bug or wanting to fiddle around with the libs.
And MDL team actually ended including the sources in their NPM because of most people asking for it.
google/material-design-lite#793

@tleunen
Copy link
Owner

tleunen commented Aug 28, 2015

The end user cannot do anything with the source since it needs a compilation step. So I was thinking to remove it from npm, but if it's the only solution to get the src folder when installing from github, I guess I'd remove it from the ignore file

@slybridges
Copy link
Contributor

As long as the README mentions that compiled components are in lib and that components can be recompiled with npm install && npm run compile, it shouldn't be a problem I'd say.

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

No branches or pull requests

4 participants