Skip to content

npm link not working #4051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nikosgpet opened this issue Jan 16, 2017 · 3 comments
Closed

npm link not working #4051

nikosgpet opened this issue Jan 16, 2017 · 3 comments

Comments

@nikosgpet
Copy link

nikosgpet commented Jan 16, 2017

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Mac OSX Sierra

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.25.5
node: 6.9.1
os: darwin x64
@angular/common: 2.4.2
@angular/compiler: 2.4.2
@angular/core: 2.4.2
@angular/forms: 2.4.2
@angular/http: 2.4.2
@angular/platform-browser: 2.4.2
@angular/platform-browser-dynamic: 2.4.2
@angular/router: 3.4.2

Mention any other details that might be useful.

I have many applications in angular that all use a common library I have created. All my libraries, including my common library use the same environment.

I use the following file structure :

|─ app1
|─ app2
|─ common
|─ environments

I have my angular apps (app1, app2), a separate folder for the common library my apps need, and a separate folder for the environments.

To include the common and environments folder in my apps, I would use npm link. This way I could make changes in my environment in one place, and all changes would be immediately available on all my projects. Unfortunately, this no longer works...

Until angular-cli.beta.22 this structure used to work. The only problem used to be that the command ng build -prod didn't take into consideration the environment.prod.ts, so I had to use a workaround for that, which wasn't very difficult.

Since I have updated to angular-cli.beta.25 this no longer works :'(

Now ng serve and ng build no longer work. They don't take into consideration the folders I have linked.

The only possible solution I have in my mind right now, would be to have a separate depository for common and environments. But that would mean that every time I make a change, I have to commit it, push it and pull it for all my projects. Not very fun...

This functionality (being able to use npm link to include external libraries) looks a very basic use case to me. So is this is a bug, or is there something I am missing?

Thanks for your help, and keep on the awesome work :)

@beeman
Copy link
Contributor

beeman commented Jan 18, 2017

@nikosgpet what you can try is instead of using npm link update your deps in package.json like this:

"shared-lib": "file:///full/os/path/to/shared-lib",

followed by an npm install. This is not ideal as it takes you to update package.json, but it might be a workaround for now.

@filipesilva
Copy link
Contributor

Dupe of #3847

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants