Skip to content
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

Linked packages can't be found during build #1130

Closed
bertday opened this issue Dec 1, 2016 · 4 comments
Closed

Linked packages can't be found during build #1130

bertday opened this issue Dec 1, 2016 · 4 comments
Milestone

Comments

@bertday
Copy link

bertday commented Dec 1, 2016

Can you reproduce the problem with latest npm?

Yes. I'm on Node 7.2.0, npm 3.10.9.

Description

I'm working on two projects at the same time, both generated with create-react-app. One exports a React component that's used by the other, so I'd like create a symlink between the two. I ran npm link within the master project and then npm link mapbook (where mapbook is the name of the project) in the client. Then in index.js for the client I have:

import Mapbook from 'mapbook'

Expected behavior

When I run npm run start, I'm expecting the module to be imported without any errors.

Actual behavior

Instead I get:

Error in ./src/index.js
Module not found: 'mapbook' in /home/ubuntu/workspace/atlas-mapbook/src

Not sure why it's not seeing the symlink in node_modules. If I change the import/export statements to CommonJS and simply node index.js it works fine, so I don't think it's a permissions issue.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):

    atlas-mapbook@0.1.0 /home/ubuntu/workspace/atlas-mapbook
    └── react-scripts@0.7.0

  2. node -v: v7.2.0

  3. npm -v: 3.10.9

Then, specify:

  1. Operating system: Ubuntu 16.04 on Cloud9; NVM preinstalled
  2. Browser and version: n/a

Reproducible Demo

https://github.com/rbrtmrtn/create-react-app-issue

Thanks for any suggestions!

@joserobleda
Copy link

I guess CRA default settings doesn't makes babel to transpile anything with a realpath outside your project.

I'm also looking for a solution to this situation. I found a workaround by ejecting, but I really don't want to..

@bertday
Copy link
Author

bertday commented Dec 2, 2016

@joserobleda interesting. What did you do after you ejected?

@gaearon
Copy link
Contributor

gaearon commented Dec 5, 2016

There is no good support for npm link workflow at the moment.
There are a few issues about this and we’ll need to consider a holistic solution at some point.

@gaearon gaearon added this to the 1.0.0 milestone Dec 5, 2016
@gaearon
Copy link
Contributor

gaearon commented Dec 5, 2016

Closing in favor of #1107, let's consolidate npm link discussion and use cases there.

@gaearon gaearon closed this as completed Dec 5, 2016
@facebook facebook locked and limited conversation to collaborators Dec 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants