Skip to content

Commit 89f8b78

Browse files
committed
Temporarily prevent npm 5 from working.
c.f. npm/npm#16893
1 parent bddd720 commit 89f8b78

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

react-native-scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-scripts",
3-
"version": "0.0.30",
3+
"version": "0.0.31",
44
"description": "Configuration and scripts for Create React Native App.",
55
"license": "BSD-3-Clause",
66
"keywords": [

react-native-scripts/src/scripts/init.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,30 @@ module.exports = async (appPath: string, appName: string, verbose: boolean, cwd:
2525
const ownPath: string = path.join(appPath, 'node_modules', ownPackageName);
2626
const useYarn: boolean = await pathExists(path.join(appPath, 'yarn.lock'));
2727

28+
// FIXME(perry) remove when npm 5 is supported
29+
if (!useYarn) {
30+
let npmVersion = spawn.sync('npm', ['--version']).stdout.toString().trim();
31+
32+
if (npmVersion.startsWith('5')) {
33+
console.log(chalk.yellow(`
34+
*******************************************************************************
35+
ERROR: npm 5 is not supported yet
36+
*******************************************************************************
37+
38+
It looks like you're using npm 5 which was recently released.
39+
40+
Create React Native App doesn't work with npm 5 yet, unfortunately. We
41+
recommend using npm 4 or yarn until some bugs are resolved.
42+
43+
You can follow the known issues with npm 5 at:
44+
https://github.com/npm/npm/issues/16991
45+
46+
*******************************************************************************
47+
`));
48+
process.exit(1);
49+
}
50+
}
51+
2852
const readmeExists: boolean = await pathExists(path.join(appPath, 'README.md'));
2953
if (readmeExists) {
3054
await fse.rename(path.join(appPath, 'README.md'), path.join(appPath, 'README.old.md'));

0 commit comments

Comments
 (0)