neume-network / core

A socially-scalable music NFT indexer.
https://neume.network
GNU General Public License v3.0
26 stars 11 forks source link

installing @neume-network/core fails because of husky or missing .git repository #84

Open TimDaub opened 2 years ago

TimDaub commented 2 years ago
 timdaub@kazoo  ~/Projects/neume-network/blueprints   main  npm i @neume-network/core

> @neume-network/core@0.1.0 postinstall /Users/timdaub/Projects/neume-network/blueprints/node_modules/@neume-network/core
> git submodule sync && git submodule update --init && cd ./src/strategies && npm install

> neume-network-strategies@0.0.1 prepare /Users/timdaub/Projects/neume-network/blueprints/node_modules/@neume-network/core/src/strategies
> husky install

.git can't be found (see https://git.io/Jc3F9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! neume-network-strategies@0.0.1 prepare: `husky install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the neume-network-strategies@0.0.1 prepare 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/timdaub/.npm/_logs/2022-09-02T13_50_55_489Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @neume-network/core@0.1.0 postinstall: `git submodule sync && git submodule update --init && cd ./src/strategies && npm install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @neume-network/core@0.1.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/timdaub/.npm/_logs/2022-09-02T13_50_56_323Z-debug.log
il3ven commented 1 year ago

@TimDaub We should remove git commands from postinstall script. As a dev I always manually update strategies to whichever branch I am working on. For the users we can add it in the readme to use git clone --recurse-submodules.

The new postinstall script will be:

"postinstall": "cd ./src/strategies && npm install",

The above will solve our problem but in case you want to keep the git commands, we can add an if condition in postinstall to only sync submodule if it is a git repo. In case of npm i @neume-network/core it isn't a git repo and so we see the original error.

postinstall script in case we use an if:

"postinstall": "if git rev-parse --git-dir > /dev/null 2>&1; then git submodule sync && git submodule update --init; fi; cd ./src/strategies && npm install",
TimDaub commented 1 year ago

For the users we can add it in the readme to use git clone --recurse-submodules.

The new postinstall script will be:

"postinstall": "cd ./src/strategies && npm install",

ok sounds good