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

Running lerna bootstrap messes with repository and files with in it. #3056

Closed
Gozala opened this issue May 29, 2020 · 9 comments
Closed

Running lerna bootstrap messes with repository and files with in it. #3056

Gozala opened this issue May 29, 2020 · 9 comments
Labels
need/author-input Needs input from the original author

Comments

@Gozala
Copy link
Contributor

Gozala commented May 29, 2020

Description:

Every time I run lerna bootstrap it seems to mess with files tracked by the repository. The worse part is it can cause data loss. I had three new directories under packages and only two were tracked by git. Running lerna bootstrap(to link local dependencies) failed because those sub-packages aren't in npm registry which caused task to error and those sub-packages vanished.

I was able to bring back two tracked by git but third one's gone for good 😭

I also end up with bunch of changes in tests files and other stuff in the other folders.


This probably rare enough scenario, but when it happens it pretty bad.

@Gozala Gozala added the need/triage Needs initial labeling and prioritization label May 29, 2020
@achingbrain
Copy link
Member

That sounds really weird, it definitely shouldn’t be deleting folders regardless of whether they contain modules published on npm or not, nor should it be editing files.

I can’t say that I see this happening. Are you doing anything that isn’t in our developer docs?

FWIW you should never have to run lerna bootstrap explicitly, it’s set up as a postinstall script so just npm i in the root and you’re done.

@Gozala
Copy link
Contributor Author

Gozala commented Jun 2, 2020

That sounds really weird, it definitely shouldn’t be deleting folders regardless of whether they contain modules published on npm or not, nor should it be editing files.

I full heartedly agree!

I can’t say that I see this happening.

I believe @lidel have seeing something along those lines too.

Are you doing anything that isn’t in our developer docs?

I do. Specifically I am have created following directories that interdepend.

  • packages/ipfs-message-port-client
  • packages/ipfs-message-port-protocol
  • packages/ipfs-message-port-server

FWIW you should never have to run lerna bootstrap explicitly, it’s set up as a postinstall script so just npm i in the root and you’re done.

The problem is that lerna boostrap errors when these packages interdepend but they aren't on npm. Here is the output npm install in the root:

npm install

> yorkie@2.0.0 uninstall /Users/gozala/Projects/js-ipfs/node_modules/yorkie
> node bin/uninstall.js

husky
uninstalling Git hooks
done


> js-ipfs@1.0.0 postinstall /Users/gozala/Projects/js-ipfs
> lerna bootstrap

lerna notice cli v3.20.2
lerna info versioning independent
lerna info Bootstrapping 27 packages
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna ERR! npm install exited 1 in 'js-ipfs'
lerna ERR! npm install stderr:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/ipfs-message-port-protocol - Not found
npm ERR! 404 
npm ERR! 404  'ipfs-message-port-protocol@^0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'js-ipfs'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gozala/.npm/_logs/2020-06-02T18_21_42_895Z-debug.log

lerna ERR! npm install exited 1 in 'js-ipfs'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! js-ipfs@1.0.0 postinstall: `lerna bootstrap`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the js-ipfs@1.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gozala/.npm/_logs/2020-06-02T18_21_43_153Z-debug.log
➜  js-ipfs (shared-worker) cd ..BB                                                                      ✗
➜  js-ipfs (shared-worker) lerna bootstrap --force-local                                                ✗
lerna notice cli v3.20.2
lerna info versioning independent
lerna info Bootstrapping 24 packages
lerna WARN EHOIST_PKG_VERSION "ipfs" package depends on ipfs-http-client@^44.0.3, which differs from the hoisted ipfs-http-client@^43.0.1.
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna ERR! npm install exited 1 in 'js-ipfs'
lerna ERR! npm install stderr:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/ipfs-message-port-server - Not found
npm ERR! 404 
npm ERR! 404  'ipfs-message-port-server@^0' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'js-ipfs'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gozala/.npm/_logs/2020-06-02T18_26_23_719Z-debug.log

lerna ERR! npm install exited 1 in 'js-ipfs'
lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.

That is also why I run lerna bootstrap --force-local manually instead.

@Gozala
Copy link
Contributor Author

Gozala commented Jun 2, 2020

Oh and BTW and as I run npm install in order to post the output here I end up with repo with ton of files being erased (not sure why those specific files get deleted, but that is also how one loseses untracked files)

git status
On branch shared-worker
Your branch is ahead of 'origin/shared-worker' by 33 commits.
  (use "git push" to publish your local commits)

Changes not staged for commit:
(use "git add/rm ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
deleted: packages/ipfs-http-client/.aegir.js
deleted: packages/ipfs-http-client/CHANGELOG.md
deleted: packages/ipfs-http-client/CONTRIBUTING.md
deleted: packages/ipfs-http-client/COPYRIGHT
deleted: packages/ipfs-http-client/LICENSE-APACHE
deleted: packages/ipfs-http-client/LICENSE-MIT
deleted: packages/ipfs-http-client/README.md
deleted: packages/ipfs-http-client/examples/browser-pubsub/README.md
deleted: packages/ipfs-http-client/examples/browser-pubsub/index.html
deleted: packages/ipfs-http-client/examples/browser-pubsub/index.js
deleted: packages/ipfs-http-client/examples/browser-pubsub/package.json
deleted: packages/ipfs-http-client/examples/browser-pubsub/util.js
deleted: packages/ipfs-http-client/examples/bundle-webpack/.eslintrc
deleted: packages/ipfs-http-client/examples/bundle-webpack/1.png
deleted: packages/ipfs-http-client/examples/bundle-webpack/README.md
deleted: packages/ipfs-http-client/examples/bundle-webpack/index.html
deleted: packages/ipfs-http-client/examples/bundle-webpack/package.json
deleted: packages/ipfs-http-client/examples/bundle-webpack/server.js
deleted: packages/ipfs-http-client/examples/bundle-webpack/src/App.js
deleted: packages/ipfs-http-client/examples/bundle-webpack/src/index.js
deleted: packages/ipfs-http-client/examples/bundle-webpack/webpack.config.js
deleted: packages/ipfs-http-client/examples/files-api/files-api.js
deleted: packages/ipfs-http-client/examples/name-api/README.md
deleted: packages/ipfs-http-client/examples/name-api/index.html
deleted: packages/ipfs-http-client/examples/name-api/index.js
deleted: packages/ipfs-http-client/examples/name-api/package.json
deleted: packages/ipfs-http-client/examples/sub-module/bundles-size-KBs.csv
deleted: packages/ipfs-http-client/examples/sub-module/complete-module.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/add/add.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/bitswap/bitswap.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/block/block.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/bootstrap/bootstrap.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/cat/cat.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/commands/commands.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/config/config.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/dht/dht.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/diag/diag.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/files/files.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/get/get.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/id/id.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/key/key.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/log/log.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/ls/ls.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/mount/mount.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/name/name.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/object/object.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/pin/pin.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/ping/ping.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/pubsub/pubsub.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/refs/refs.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/repo/repo.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/swarm/swarm.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/update/update.js
deleted: packages/ipfs-http-client/examples/sub-module/modules/version/version.js
deleted: packages/ipfs-http-client/examples/sub-module/package.json
deleted: packages/ipfs-http-client/examples/sub-module/test-modules-size.sh
deleted: packages/ipfs-http-client/examples/sub-module/webpack.config.js
deleted: packages/ipfs-http-client/examples/upload-file-via-browser/README.md
deleted: packages/ipfs-http-client/examples/upload-file-via-browser/index.html
deleted: packages/ipfs-http-client/examples/upload-file-via-browser/package.json
deleted: packages/ipfs-http-client/examples/upload-file-via-browser/screenshot.png
deleted: packages/ipfs-http-client/examples/upload-file-via-browser/src/App.js
deleted: packages/ipfs-http-client/examples/upload-file-via-browser/src/index.js
deleted: packages/ipfs-http-client/maintainer.json
deleted: packages/ipfs-http-client/package.json
deleted: packages/ipfs-http-client/src/add.js
deleted: packages/ipfs-http-client/src/bitswap/index.js
deleted: packages/ipfs-http-client/src/bitswap/stat.js
deleted: packages/ipfs-http-client/src/bitswap/unwant.js
deleted: packages/ipfs-http-client/src/bitswap/wantlist.js
deleted: packages/ipfs-http-client/src/block/get.js
deleted: packages/ipfs-http-client/src/block/index.js
deleted: packages/ipfs-http-client/src/block/put.js
deleted: packages/ipfs-http-client/src/block/rm.js
deleted: packages/ipfs-http-client/src/block/stat.js
deleted: packages/ipfs-http-client/src/bootstrap/add.js
deleted: packages/ipfs-http-client/src/bootstrap/index.js
deleted: packages/ipfs-http-client/src/bootstrap/list.js
deleted: packages/ipfs-http-client/src/bootstrap/rm.js
deleted: packages/ipfs-http-client/src/cat.js
deleted: packages/ipfs-http-client/src/commands.js
deleted: packages/ipfs-http-client/src/config/get.js
deleted: packages/ipfs-http-client/src/config/index.js
deleted: packages/ipfs-http-client/src/config/profiles/apply.js
deleted: packages/ipfs-http-client/src/config/profiles/index.js
deleted: packages/ipfs-http-client/src/config/profiles/list.js
deleted: packages/ipfs-http-client/src/config/replace.js
deleted: packages/ipfs-http-client/src/config/set.js
deleted: packages/ipfs-http-client/src/dag/get.js
deleted: packages/ipfs-http-client/src/dag/index.js
deleted: packages/ipfs-http-client/src/dag/put.js
deleted: packages/ipfs-http-client/src/dag/resolve.js
deleted: packages/ipfs-http-client/src/dht/find-peer.js
deleted: packages/ipfs-http-client/src/dht/find-provs.js
deleted: packages/ipfs-http-client/src/dht/get.js
deleted: packages/ipfs-http-client/src/dht/index.js
deleted: packages/ipfs-http-client/src/dht/provide.js
deleted: packages/ipfs-http-client/src/dht/put.js
deleted: packages/ipfs-http-client/src/dht/query.js
deleted: packages/ipfs-http-client/src/dht/response-types.js
deleted: packages/ipfs-http-client/src/diag/cmds.js
deleted: packages/ipfs-http-client/src/diag/index.js
deleted: packages/ipfs-http-client/src/diag/net.js
deleted: packages/ipfs-http-client/src/diag/sys.js
deleted: packages/ipfs-http-client/src/dns.js
deleted: packages/ipfs-http-client/src/files/chmod.js
deleted: packages/ipfs-http-client/src/files/cp.js
deleted: packages/ipfs-http-client/src/files/flush.js
deleted: packages/ipfs-http-client/src/files/index.js
deleted: packages/ipfs-http-client/src/files/ls.js
deleted: packages/ipfs-http-client/src/files/mkdir.js
deleted: packages/ipfs-http-client/src/files/mv.js
deleted: packages/ipfs-http-client/src/files/read.js
deleted: packages/ipfs-http-client/src/files/rm.js
deleted: packages/ipfs-http-client/src/files/stat.js
deleted: packages/ipfs-http-client/src/files/touch.js
deleted: packages/ipfs-http-client/src/files/utils.js
deleted: packages/ipfs-http-client/src/files/write.js
deleted: packages/ipfs-http-client/src/get-endpoint-config.js
deleted: packages/ipfs-http-client/src/get.js
deleted: packages/ipfs-http-client/src/id.js
deleted: packages/ipfs-http-client/src/index.js
deleted: packages/ipfs-http-client/src/key/export.js
deleted: packages/ipfs-http-client/src/key/gen.js
deleted: packages/ipfs-http-client/src/key/import.js
deleted: packages/ipfs-http-client/src/key/index.js
deleted: packages/ipfs-http-client/src/key/list.js
deleted: packages/ipfs-http-client/src/key/rename.js
deleted: packages/ipfs-http-client/src/key/rm.js
deleted: packages/ipfs-http-client/src/lib/buffer-to-form-data.browser.js
deleted: packages/ipfs-http-client/src/lib/buffer-to-form-data.js
deleted: packages/ipfs-http-client/src/lib/configure.js
deleted: packages/ipfs-http-client/src/lib/core.js
deleted: packages/ipfs-http-client/src/lib/encode-buffer-uri-component.js
deleted: packages/ipfs-http-client/src/lib/mode-to-string.js
deleted: packages/ipfs-http-client/src/lib/mtime-to-object.js
deleted: packages/ipfs-http-client/src/lib/multipart-request.js
deleted: packages/ipfs-http-client/src/lib/object-to-camel-with-metadata.js
deleted: packages/ipfs-http-client/src/lib/object-to-camel.js
deleted: packages/ipfs-http-client/src/lib/to-stream.browser.js
deleted: packages/ipfs-http-client/src/lib/to-stream.js
deleted: packages/ipfs-http-client/src/lib/to-url-search-params.js
deleted: packages/ipfs-http-client/src/log/index.js
deleted: packages/ipfs-http-client/src/log/level.js
deleted: packages/ipfs-http-client/src/log/ls.js
deleted: packages/ipfs-http-client/src/log/tail.js
deleted: packages/ipfs-http-client/src/ls.js
deleted: packages/ipfs-http-client/src/mount.js
deleted: packages/ipfs-http-client/src/name/index.js
deleted: packages/ipfs-http-client/src/name/publish.js
deleted: packages/ipfs-http-client/src/name/pubsub/cancel.js
deleted: packages/ipfs-http-client/src/name/pubsub/index.js
deleted: packages/ipfs-http-client/src/name/pubsub/state.js
deleted: packages/ipfs-http-client/src/name/pubsub/subs.js
deleted: packages/ipfs-http-client/src/name/resolve.js
deleted: packages/ipfs-http-client/src/object/data.js
deleted: packages/ipfs-http-client/src/object/get.js
deleted: packages/ipfs-http-client/src/object/index.js
deleted: packages/ipfs-http-client/src/object/links.js
deleted: packages/ipfs-http-client/src/object/new.js
deleted: packages/ipfs-http-client/src/object/patch/add-link.js
deleted: packages/ipfs-http-client/src/object/patch/append-data.js
deleted: packages/ipfs-http-client/src/object/patch/index.js
deleted: packages/ipfs-http-client/src/object/patch/rm-link.js
deleted: packages/ipfs-http-client/src/object/patch/set-data.js
deleted: packages/ipfs-http-client/src/object/put.js
deleted: packages/ipfs-http-client/src/object/stat.js
deleted: packages/ipfs-http-client/src/pin/add.js
deleted: packages/ipfs-http-client/src/pin/index.js
deleted: packages/ipfs-http-client/src/pin/ls.js
deleted: packages/ipfs-http-client/src/pin/rm.js
deleted: packages/ipfs-http-client/src/ping.js
deleted: packages/ipfs-http-client/src/pubsub/index.js
deleted: packages/ipfs-http-client/src/pubsub/ls.js
deleted: packages/ipfs-http-client/src/pubsub/peers.js
deleted: packages/ipfs-http-client/src/pubsub/publish.js
deleted: packages/ipfs-http-client/src/pubsub/subscribe.js
deleted: packages/ipfs-http-client/src/pubsub/subscription-tracker.js
deleted: packages/ipfs-http-client/src/pubsub/unsubscribe.js
deleted: packages/ipfs-http-client/src/refs/index.js
deleted: packages/ipfs-http-client/src/refs/local.js
deleted: packages/ipfs-http-client/src/repo/gc.js
deleted: packages/ipfs-http-client/src/repo/index.js
deleted: packages/ipfs-http-client/src/repo/stat.js
deleted: packages/ipfs-http-client/src/repo/version.js
deleted: packages/ipfs-http-client/src/resolve.js
deleted: packages/ipfs-http-client/src/stats/bw.js
deleted: packages/ipfs-http-client/src/stats/index.js
deleted: packages/ipfs-http-client/src/stop.js
deleted: packages/ipfs-http-client/src/swarm/addrs.js
deleted: packages/ipfs-http-client/src/swarm/connect.js
deleted: packages/ipfs-http-client/src/swarm/disconnect.js
deleted: packages/ipfs-http-client/src/swarm/index.js
deleted: packages/ipfs-http-client/src/swarm/localAddrs.js
deleted: packages/ipfs-http-client/src/swarm/peers.js
deleted: packages/ipfs-http-client/src/update.js
deleted: packages/ipfs-http-client/src/version.js
deleted: packages/ipfs-http-client/test/commands.spec.js
deleted: packages/ipfs-http-client/test/constructor.spec.js
deleted: packages/ipfs-http-client/test/custom-headers.spec.js
deleted: packages/ipfs-http-client/test/dag.spec.js
deleted: packages/ipfs-http-client/test/diag.spec.js
deleted: packages/ipfs-http-client/test/endpoint-config.spec.js
deleted: packages/ipfs-http-client/test/exports.spec.js
deleted: packages/ipfs-http-client/test/fixtures/.gitattributes
deleted: packages/ipfs-http-client/test/fixtures/15mb.random
deleted: packages/ipfs-http-client/test/fixtures/r-config.json
deleted: packages/ipfs-http-client/test/fixtures/ssl/cert.pem
deleted: packages/ipfs-http-client/test/fixtures/ssl/privkey.pem
deleted: packages/ipfs-http-client/test/fixtures/test-folder/.hiddenTest.txt
deleted: packages/ipfs-http-client/test/fixtures/test-folder/add
deleted: packages/ipfs-http-client/test/fixtures/test-folder/cat
deleted: packages/ipfs-http-client/test/fixtures/test-folder/files/hello.txt
deleted: packages/ipfs-http-client/test/fixtures/test-folder/files/ipfs.txt
deleted: packages/ipfs-http-client/test/fixtures/test-folder/hello-link
deleted: packages/ipfs-http-client/test/fixtures/test-folder/ipfs-add
deleted: packages/ipfs-http-client/test/fixtures/test-folder/ls
deleted: packages/ipfs-http-client/test/fixtures/test-folder/version
deleted: packages/ipfs-http-client/test/fixtures/testconfig.json
deleted: packages/ipfs-http-client/test/fixtures/testfile.txt
deleted: packages/ipfs-http-client/test/get.spec.js
deleted: packages/ipfs-http-client/test/interface.spec.js
deleted: packages/ipfs-http-client/test/key.spec.js
deleted: packages/ipfs-http-client/test/lib.error-handler.spec.js
deleted: packages/ipfs-http-client/test/log.spec.js
deleted: packages/ipfs-http-client/test/node.js
deleted: packages/ipfs-http-client/test/node/swarm.js
deleted: packages/ipfs-http-client/test/ping.spec.js
deleted: packages/ipfs-http-client/test/repo.spec.js
deleted: packages/ipfs-http-client/test/request-api.spec.js
deleted: packages/ipfs-http-client/test/stats.spec.js
deleted: packages/ipfs-http-client/test/sub-modules.spec.js
deleted: packages/ipfs-http-client/test/utils/factory.js
deleted: packages/ipfs-http-client/test/utils/throws-async.js
deleted: packages/ipfs-message-port-protocol/package.json
deleted: packages/ipfs-message-port-protocol/src/core.ts
deleted: packages/ipfs-message-port-protocol/src/dag.ts
deleted: packages/ipfs-message-port-protocol/src/data.ts
deleted: packages/ipfs-message-port-protocol/src/files.ts
deleted: packages/ipfs-message-port-protocol/src/rpc.ts
deleted: packages/ipfs-message-port-protocol/tsconfig.json
deleted: packages/ipfs-message-port-server/package.json
deleted: packages/ipfs-message-port-server/src/core.js
deleted: packages/ipfs-message-port-server/src/dag.js
deleted: packages/ipfs-message-port-server/src/files.js
deleted: packages/ipfs-message-port-server/src/index.js
deleted: packages/ipfs-message-port-server/src/ipfs.ts
deleted: packages/ipfs-message-port-server/src/server.js
deleted: packages/ipfs-message-port-server/src/util.js
deleted: packages/ipfs-message-port-server/tsconfig.json

no changes added to commit (use "git add" and/or "git commit -a")

@vasco-santos
Copy link
Member

vasco-santos commented Jun 2, 2020

I think that this issue is related to what is happening with me on: #3019

the ipfs-http-client dependency is not available inside the node_modules folder after the install

@achingbrain
Copy link
Member

Do you still see this problem?

@achingbrain achingbrain added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels Jul 2, 2020
@Gozala
Copy link
Contributor Author

Gozala commented Jul 2, 2020

Do you still see this problem?

I think it's still there and can be reproduced by killing the process.

@achingbrain
Copy link
Member

I've definitely seen it mess up the package.json files if I kill the process in the middle of a bootstrap (though not deleting folders as you say above). I've worked around it by, uh, not doing that.

It might be worth opening an issue on the lerna repo about it?

@achingbrain
Copy link
Member

I'm going to close this issue as I don't think there's an action for us here. Please open an issue on the lerna repo and maybe they can help.

@achingbrain
Copy link
Member

Possibly related: lerna/lerna#2683

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/author-input Needs input from the original author
Projects
None yet
Development

No branches or pull requests

3 participants