Questions tagged [npm-link]

npm link is a command on npm CLI which symlink's a package folder

Reference:

176 questions
9
votes
2 answers

Can't npm link multiple packages

I'm getting a weird error while linking local packages: I have 2 packages (let's call them A and B). When I link either one of those to my project using npm link A it works as intended. But then I try to link the other one as well using npm link B…
Devoev
  • 374
  • 1
  • 10
9
votes
5 answers

Create React App with TypeScript and NPM Link: Enums causing Module parse failed

I have a basic create-react-app TypeScript project (client). Just directory up, I have a server and a shared folder. Inside the shared folder I have a number of interfaces and enums that I share between the server and the client. I wish to link this…
foxtrotuniform6969
  • 3,527
  • 7
  • 28
  • 54
9
votes
1 answer

using dist folder instead of root for npm package

I created a Node.js package and the files to be referenced by the user of this package reside in a dist folder inside the package. Now I don't want to use require('my-package/dist/feature') but require('my-package/feature'). I set main and files to…
Alexander Zeitler
  • 11,919
  • 11
  • 81
  • 124
8
votes
0 answers

Uncaught TypeError: Cannot read properties of null (reading 'useEffect')

Edit So, what turned out to be the problem? I had two instances of React and ReactDOM contributing to the served bundle of applicationB. I was misled in diagnosing the problem-space and therefore the question(s)/appeal raised below is a little…
slackermorris
  • 368
  • 3
  • 11
8
votes
1 answer

VSCode debugger: set a breakpoint in a Typescript package symlinked with `npm link`

I'm trying to debug a NodeJS app and its related typescript packages linked with npm link. Structure looks like this: /root/package-a # typescript package /root/package-b # another typescript package /root/app # NodeJS application I have linked the…
8
votes
1 answer

Angular 10.x library development with npm link doesn't show html/css changes in browser on hot reload

I've created an Angular lib (mylib) using the cli and have created a symlink using npm link from the dist directory. I've created an Angular app using the cli and have linked the lib using npm link mylib. I am able to consume mylib from the app and…
Mike
  • 665
  • 6
  • 14
8
votes
1 answer

How to fix "Module not found" error in Angular library with npm link?

I'm trying to build an Angular wrapper for a Javascript library but I'm getting a "Module not found" error. The Javascript library is in development and not yet published to NPM, so I'm using npm-link which might be causing the problem, but I'm not…
Elliot
  • 415
  • 2
  • 5
  • 13
8
votes
4 answers

npm install after npm link-ing local module causes error: Not found

package.json of module-A has module-B listed as dependency "dependencies": { "@mynamespace/module-b": "^0.0.1", module B is a local module and is linked successfully from module A with npm link. Compiling / running things all goes good and…
Flion
  • 10,468
  • 13
  • 48
  • 68
8
votes
0 answers

How to 'npm link' Angular library with a shared library?

For my Angular 4.x application (App) I wrote a library (e.g 'Lib') which is currently not AoT compatible. Both App and Lib depend on a 3rd party library (e.g. 'X'). When I use “npm link” to develop Lib in App, some things stop working since X is…
7
votes
1 answer

Multiple npm link in one project

i'm struggling to use npm link. in fact i have two local packages that i would like to use in my project. on each of the packages I performed the sudo npm link command. when I do an npm -g list I can therefore see these packages and their…
lhapaipai
  • 336
  • 2
  • 9
7
votes
1 answer

Are `yarn link` and `npm link` interoperable?

I know there are subtle differences between yarn and npm. Now I have a library managed with yarn and an app managed with npm. Should it work without issues, if I create a linked pkg in my lib directory via yarn and apply it via npm in my other…
helt
  • 4,925
  • 3
  • 35
  • 54
7
votes
3 answers

Link react versions between linked library and workspace application

I'm developing a React library for my common used components. In my root folder where there is: my rollup config and my src/ folder containing my library. When it's build, the bundle files (ES, CJS and UMD) are in the dist/ folder. my workspace: a…
Bastien Robert
  • 809
  • 1
  • 10
  • 31
7
votes
1 answer

Typescript can not find locally linked module?

I'm trying to test some typescript definitions that I made for a node project that doesn't have any. They work already when I include them in my project that consumes the target node project, or when I make my own folder in node_modules/@types/ and…
samuraiseoul
  • 2,888
  • 9
  • 45
  • 65
7
votes
3 answers

Unexpected behaviour with `npm install` of a local project

Scenario I am using npm 5.8.0 I am having a ProjectA and a ProjectB ProjectB is a dependency of ProjectA Both project are being bundled and run via Webpack (I can provide my configuration if necessary). For development purposes I am referencing…
チーズパン
  • 2,752
  • 8
  • 42
  • 63
7
votes
0 answers

Get __dirname to point to folder path rather than real path of sym-linked folder

How to get __dirname to point to the preserved path of the folder rather than the real path of the symlinked file when using npm link. Scenario Folder Setup project | ---- moduleA | | | ---- moduleA.js | ---- app | …
takinola
  • 1,643
  • 1
  • 12
  • 23
1
2
3
11 12