简体   繁体   中英

Import npm module installed directly from github

There is an npm package that I want to use in my Meteor app. It was missing some features so I forked the repo and applied the patch myself. I installed the forked package using:

meteor npm install --save https://github.com/suheb/react-slick.git

Now when I try to use the package using import Slider from 'react-slick' , I get the following error:

Uncaught Error: Cannot find module 'react-slick' install.js:101

How can I use this package installed directly from github?

PS: I have asked the original owner to update the package on npm registry but I'm not sure long it'll take.

The package you want to install needs to be compiled by Babel before you can use it. GitHub repo contains only source code, not compiled JS. As @noah suggested, what is published to the NPM registry is compiled code (the result of running prepublish script defined in package.json ).

Currently you are not able to install this kind of packages directly from a Git repository - the issue in NPM command line client that prevents it is tracked here: https://github.com/npm/npm/issues/3055

Please consider using this helper script (authored by me): https://github.com/lzrski/npm-git-install/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM