Skip to content

Commit

Permalink
Forcing npm@8.16.0 to fix the issue: #367
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshrvel committed Jun 12, 2024
1 parent 9ac253c commit 31bd3c9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ definitions:

mac_m1_env_versions: &mac_m1_env_versions
node: 16.19.0
npm: 8
npm: 8.16.0
xcode: 15.3

mac_intel_x64_env_versions: &mac_intel_x64_env_versions
node: 16.19.0
npm: 8
npm: 8.16.0
xcode: 14.2

mac_m1_arm64_artifacts: &mac_m1_arm64_artifacts
Expand Down
22 changes: 22 additions & 0 deletions internals/scripts/CheckYarn.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
const { execSync } = require('child_process');
const semver = require('semver');

const requiredVersionRange = '>=6.x <=8.16.0';

try {
const npmVersion = execSync('npm -v').toString().trim();

if (!semver.satisfies(npmVersion, requiredVersionRange)) {
console.error(
`Error: This project requires npm version ${requiredVersionRange}. You have version ${npmVersion}.\nPlease downgrade your npm, this is due to a bug in node-gyp. Github issue: https://github.com/ganeshrvel/openmtp/issues/367.\ncommand: npm install -g npm@8.16.0`
);
process.exit(1);
}

console.info(`Using compatible npm version: ${npmVersion}`);
} catch (error) {
console.error('Error checking npm version:', error);

process.exit(1);
}

if (!/yarn\.js$/.test(process.env.npm_execpath || '')) {
console.warn(
"\u001b[33mYou don't seem to be using yarn. This could produce unexpected results.\u001b[39m"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
},
"devEngines": {
"node": ">=16.x",
"npm": ">=6.x",
"npm": ">=6.x <=8.16.0",
"yarn": ">=0.21.3"
}
}

0 comments on commit 31bd3c9

Please sign in to comment.