Skip to content

Linked packages can't be found during build #1130

Closed

Description

@rmx90210

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!

Activity

  1. joserobleda commented on Dec 1, 2016

    @joserobleda

    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..

  2. rmx90210 commented on Dec 2, 2016

    @rmx90210
    Author

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

  3. gaearon commented on Dec 5, 2016

    @gaearon
    Contributor

    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.

  4. added this to the 1.0.0 milestone on Dec 5, 2016
  5. gaearon commented on Dec 5, 2016

    @gaearon
    Contributor

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

  6. locked and limited conversation to collaborators on Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions