0

I used to install an npm project from github by doing

git clone http...my_project
npm install my_project

Instead of copying the contents of my_project to my local node_modules folder, it actually created a symlink from node_modules/my_project to my_project, then I could modify everything on my git cloned folder and it'd be on my project.

I believe this behavior changed in newer versions because it won't create the symlink anymore. It just copies the folder to node_modules

Is there a way to do it again?

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
  • Check this out: https://docs.npmjs.com/cli/link . – Vossen Apr 20 '18 at 09:46
  • @Vossen I forgot to mention that I know link, but it actually does a lot of things in the background and it needs root permission. Isn't there an easier way? –  Apr 20 '18 at 09:48
  • May be try this link :https://stackoverflow.com/questions/16151018/npm-throws-error-without-sudo – soorapadman Apr 20 '18 at 09:58

2 Answers2

0

Try this:

npm install "file:your/module/path" --save
4ndt3s
  • 3,238
  • 2
  • 20
  • 30
  • The first time I did, it worked. Then I removed and tried again and all I get is `-- react-native-pagination@1.2.5 invalid, when it finishes. In this case, react-native-pagination is the name of my package. Do you know what that means? (I deleted everything from node_modules and the cloned repo) –  Apr 20 '18 at 10:34
  • Add --save (see my edited answer) the first time, delete node_modules folder and then you can type only `npm install` – 4ndt3s Apr 20 '18 at 10:40
  • it is still copying the folder. Don't know how it worked in the first time –  Apr 21 '18 at 12:12
  • I think this [answer](https://stackoverflow.com/questions/49771724/setting-angular-package-development-setup#answer-49774330) will help you. – 4ndt3s Apr 21 '18 at 12:30
0

Instead of running:

git clone http...my_project
npm install my_project

Use this:

git clone http...my_project
cd my_project
npm install
antzshrek
  • 9,276
  • 5
  • 26
  • 43