Git action npm
install` failing while it works on my machine. This my action
name: Check for lint/build errors
on:
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.SEMANTIC_RELEASE_PAT }}
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Set NPM_TOKEN
run: echo "NPM_TOKEN=${{ secrets.NPM_TOKEN }}" >> $GITHUB_ENV
- name: npm install, lint
run: |
npm install
npm run lint
In my machine, I am using node
version v16.3.0
Ps: On my local machine, I have removed package-lock.json
and it still works fine.
Here is the exact error
npm ERR! While resolving: @react-native-async-storage/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react-native
npm ERR! react-native@"0.68.2" from the root project
npm ERR! peer react-native@">=0.64.0-rc.0 || 0.0.0-*" from @react-native-community/[email protected]
npm ERR! node_modules/@react-native-community/cli
npm ERR! dev @react-native-community/cli@"^5.0.1" from the root project
npm ERR! 11 more (react-native-actions-sheet, react-native-check-box, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native@"^0.0.0-0 || ^0.60.6 || ^0.61.5 || ^0.62.2 || ^0.63.2 || ^0.64.0 || ^0.65.0 || ^0.66.0 || 1000.0.0" from @react-native-async-storage/[email protected]
npm ERR! node_modules/@react-native-async-storage/async-storage
npm ERR! @react-native-async-storage/async-storage@"^1.15.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/react-native
npm ERR! peer react-native@"^0.0.0-0 || ^0.60.6 || ^0.61.5 || ^0.62.2 || ^0.63.2 || ^0.64.0 || ^0.65.0 || ^0.66.0 || 1000.0.0" from @react-native-async-storage/[email protected]
npm ERR! node_modules/@react-native-async-storage/async-storage
npm ERR! @react-native-async-storage/async-storage@"^1.15.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-12-30T10_36_18_687Z-debug-0.log
Any idea why this could be happening and how I can fix it.
CodePudding user response:
You should add package-lock.json
to your git repository.
Second option that is not recommended and can lead to hard to reproduce behaviours is
npm i --force
You can check difference between force and legacy-peer-deps here:
npm: When to use `--force` and `--legacy-peer-deps`
To reporoduce this problem locally you have to remove not only package-lock.json
but also node_modules
.