I've been using npm install react-financial-charts
successfully. However, I want to include this package locally instead (for reasons), so I checked out the master branch of react-financial-charts
from Github. I now have two folders:
C:\Users\user\projects\react-financial-charts // fresh checkout from Github
C:\Users\user\projects\myproject // my project
Inside of my project, my package.json
contains:
"dependencies": {
"react-financial-charts": "file:C:/Users/user/projects/react-financial-charts"
}
npm run dev
will now encounter the compile error corresponding to a basic import statement import { BarSeries } from "react-financial-charts"
in one of my files:
Module not found: Error: Can't resolve 'react-financial-charts' in 'C:\Users\user\projects\myproject\src\App'
So basically, the simple import statement which used to work (when I was doing npm install react-financial-charts
), is now no longer working when I install the dependency from a local folder instead.
EDIT: I also tried these things that an answer below suggested, but I'm getting the exact same error message:
npm link ../react-financial charts
npm install ../react-financial charts
npm install --save ../react-financial charts
EDIT 2: This ended up working, thanks to the suggested answer below. The trick was I needed to npm update
and npm install
inside the dependency before linking.
cd react-financial-charts
npm link
cd ../myproject
npm link react-financial-charts