dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
200 stars 37 forks source link

npm ERR! code EUNSUPPORTEDPROTOCOL when using yarn's "workspace:" #129

Open manast opened 1 year ago

manast commented 1 year ago

I am using yarn workspaces, and in order to depend one package to another in my monorepo I am using yarn's workspace protocol (https://yarnpkg.com/features/workspaces#publishing-workspaces) However when trying to run multi-semantic-release it errors with the following:

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:packages/dashboard

Reference: https://github.com/taskforcesh/nandu/runs/8274785071?check_suite_focus=true#step:5:91

manast commented 1 year ago

Update: using workspace:* does not help either:

npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "workspace:": workspace:*

If the workspace protocol is not supported, how do you guys manage intra module dependencies?

manast commented 1 year ago

So last three days I spent trying to make the release to no avail... tried everything I could came up with. In the last iteration I changed to pnpm instead of yarn. Interestingly it works to make a dry releae locally, but not on github actions...

https://github.com/taskforcesh/nandu/actions/runs/3040480203/jobs/4896572401

By using custom semantic-release/npm with a never version of npm I manage to go a step further but then got stuck with another error impossible to understand: npm ERR! Cannot read properties of null (reading 'matches')\n"

https://github.com/taskforcesh/nandu/actions/runs/3040464168/jobs/4896538148

I do not expect to get any help at this point, but certainly if you read this and are considering to use monorepos and semantic-release, you may also spend several days like I did to no avail...

aarne commented 1 year ago

get the /home/runner/.npm/_logs/* from actions and things will get more transparent i hope. Add something like this as the last step in your action.

      - name: Store error logs
        uses: actions/upload-artifact@v3
        if: failure()
        with:
          name: npm-logs
          path: /home/runner/.npm/_logs/

Also you can see the command executed that errored out npm version 1.0.0 --userconfig "/tmp/c4c21035de7032234bf3da5d11dbc535/.npmrc" --no-git-tag-version --allow-same-version. Running it manually might make it simpler to diagnose

manast commented 1 year ago

@aarne Thanks. Yes, by uploading the log files I could see that the error came from "arborist" an internal module used by node itself. Downgrading to node 14 did the trick... although I did not investigate what is the root cause.

aarne commented 1 year ago

https://github.com/semantic-release/npm/pull/512#issuecomment-1245406224

aarne commented 1 year ago

The problem is with npm starting from version 8.5 that comes by default with node 16.15.

Adding workspaces-update = false to your .npmrc will fix the issue on newer npm versions

antongolub commented 1 year ago

@aarne,

Thanks for the digging. We use yarn for our monorepos, so we have never faced with this kind of npm features. Could you pls update the readme.md troubleshooting section?

UPD I forgot that there is already such a mention. )))

npm v8.5+: npm ERR! notarget No matching version found for... When releasing a monorepo you may get a npm ERR! code ETARGET error. This is caused by npm version creating a reify update on packages with future dependency versions MSR has not updated yet. The simplest work around is to set workspaces-update to false either in your .npmrc or manually by running npm config set workspaces-update false