mirror of
https://github.com/strapi/strapi.git
synced 2025-09-20 22:10:06 +00:00
Fixed the issue where command throws an error if strapi key is not in package.json
This commit is contained in:
parent
ce5ddb2868
commit
d007218b96
@ -9,7 +9,7 @@ const machineID = require('../utils/machine-id');
|
||||
const readPackageJSON = async path => {
|
||||
try {
|
||||
const packageObj = await fse.readJson(path);
|
||||
const uuid = packageObj.strapi.uuid;
|
||||
const uuid = packageObj.strapi ? packageObj.strapi.uuid : null;
|
||||
|
||||
return [uuid, packageObj];
|
||||
} catch (err) {
|
||||
@ -52,7 +52,7 @@ module.exports = async function optOutTelemetry() {
|
||||
|
||||
const [uuid, packageObj] = await readPackageJSON(packageJSON);
|
||||
|
||||
if (packageObj.strapi.telemetryDisabled || !uuid) {
|
||||
if ((packageObj.strapi && packageObj.strapi.telemetryDisabled) || !uuid) {
|
||||
console.log(`${chalk.yellow('Warning:')} telemetry is already disabled`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user