1

I'm using react-select on my ReactJS module, and I needed to make some changes to fit my needs.

But now, I'm trying to install my own fork using NPM, and it doesn't work.

Error message:

Module not found: Error: Can't resolve 'react-select'

Tried using gitpkg with the following commands, and it did not work.

npm install 'willnaoosmith/react-select'
npm install 'https://gitpkg.now.sh/willnaoosmith/react-select/packages/react-select?master'
npm install -B 'willnaoosmith/react-select'

The module uses TypeScript, and my changes are on the packages/react-select.

When I try to install it using npm install 'willnaoosmith/react-select' it creates a @react-select/monorepo entry on my package.json

When I try to install using npm install 'https://gitpkg.now.sh/willnaoosmith/react-select/packages/react-select?master' it doesn't create the dist folders on the directories inside node_modules/react-select/packages/react-select/

What am I missing?

2 Answers 2

1

If you only want to test your changes locally before publishing to ensure they work you can follow the steps below:

Say, you're developing an app called A and B is the react-select package you made changes to locally, then:

  1. Go to the project folder for B and enter npm link - this will create a local package called B.
  2. Now go to your project (A) folder and enter npm link B - this will link your project to the local package (B).

Any changes you make to B should reflect in A without having to publish it.

Another option is to use your repository directory with the following steps:

  1. Push your code changes from your updated package to GitHub
  2. Tag the just pushed commit
  3. In your project, run npm install github_username/repository#tag

You can see the following link for details

2
  • npm install github_username/repository#tag didn't work. I tried using the directory inside my fork, and it doesn't build the dist files like npm install react-select does. Commented Jun 26 at 20:23
  • Did you open the link I posted for more details? It might be more thorough than my answer.
    – codejockie
    Commented Jun 27 at 12:38
0

Solution: Had to publish my own package version. Bye

Not the answer you're looking for? Browse other questions tagged or ask your own question.