Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

whack link appears to symlink #9

Closed
peterp opened this issue Jul 6, 2017 · 7 comments
Closed

whack link appears to symlink #9

peterp opened this issue Jul 6, 2017 · 7 comments

Comments

@peterp
Copy link

peterp commented Jul 6, 2017

It appears that whackage creates a symlink just like npm link does.

> whack init
> whack link ../my-react-native-library
[whackage] Package my-react-native-library is not a registered dependency in my-app

I add "my-react-native-library": "0.0.1" to packages.json dependencies and try again

> whack link ../my-react-native-library

This works now, and packages.json dependency is now: "my-react-native-library": "file:../my-react-native-library"

> whack run start
[whackage] Package my-react-native-library appears to be symlinked. Overwriting symlinks is not currently supported. Unlink package and try again.
node v8.1.3
npm 5.1.0
@jevakallio
Copy link
Contributor

I don't think there is any way whackage is doing the symlinking.

It is however possible that the isNotSymlinked check is returning a false negative, or that you have a preexisting symlink from some previous attempt to solve the problem?

I'm also fairly sure that whackage should not modify your package.json - though it's been a long time since I worked on this, so I could be wrong about that.

@peterp
Copy link
Author

peterp commented Jul 6, 2017

I was using npm install ../relativepath beforehand, so I changed the name and location of my package to see if it was a cached issue.

> ls -al node_modules/chatterview2
ls: node_modules/chatterview2: No such file or directory
> whack link ../chatterview2/
> linked chatterview2 -> /Users/peterp/Personal/chatterview2
> ls -al node_modules/chatterview2
lrwxr-xr-x  1 peterp  staff  18 Jul  6 15:36 node_modules/chatterview2 -> ../../chatterview2

afaik npm install ../relative-path updates the package's dependencies and creates a symlink, which it appears what link is doing here:

spawn('npm', ['install', relativePath], (code) => {

Perhaps that wasn't true awhile back?

@jevakallio
Copy link
Contributor

jevakallio commented Jul 6, 2017

Ah, you must be using npm 5! According to the npm5 release notes, both of these are actually perfectly logical issues:

  • npm install ./packages/subdir will now create a symlink instead of a regular installation
  • npm will --save by default now.

Unfortunately that means that whackage is currently not npm 5 compatible. If you want to figure out how to solve this, pull requests are welcome. I am currently busy with other work and travelling, don't expect to get to this for at least a few weeks.

@peterp
Copy link
Author

peterp commented Jul 6, 2017

A quick glance at the React Native repo is showing that there's a bunch of problems with npm 5 and react-native, so I'm downgrading to npm 4:

npm install -g npm@latest-4

For anyone tackling the npm 5 issue: There is a flag to disable the automatic saving in packages.json --no-save, but I don't think it's possible to disable the symlinks.

@jpdriver
Copy link
Contributor

related: #17

@peterp
Copy link
Author

peterp commented Oct 18, 2017

@jpdriver I've started using haul whilst building local packages, it handles symlinks rather easily. You don't need to add the build steps to gradle/ xcode

@jevakallio
Copy link
Contributor

@peterp Haul is great, glad it's working out for you.

In the meantime, I just released whackage 1.2.0 with NPM 5 support https://github.com/FormidableLabs/whackage/releases/tag/v1.2.0

Closing this issue now, feel free to message to reopen if needed!

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