mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
Fix #6244, dpendency auto-install fixed
Node caches the result of stat on module directories
This commit is contained in:
committed by
Julian Lam
parent
82f2025944
commit
c8a6caa842
@@ -8,9 +8,9 @@ var dirname = require('./paths').baseDir;
|
|||||||
|
|
||||||
// check to make sure dependencies are installed
|
// check to make sure dependencies are installed
|
||||||
try {
|
try {
|
||||||
require('../../package.json');
|
fs.accessSync(path.join(dirname, 'package.json'), fs.constants.R_OK);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code === 'MODULE_NOT_FOUND') {
|
if (e.code === 'ENOENT') {
|
||||||
console.warn('package.json not found.');
|
console.warn('package.json not found.');
|
||||||
console.log('Populating package.json...');
|
console.log('Populating package.json...');
|
||||||
|
|
||||||
@@ -18,6 +18,8 @@ try {
|
|||||||
packageInstall.preserveExtraneousPlugins();
|
packageInstall.preserveExtraneousPlugins();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
fs.accessSync(path.join(dirname, 'node_modules/colors/package.json'), fs.constants.R_OK);
|
||||||
|
|
||||||
require('colors');
|
require('colors');
|
||||||
console.log('OK'.green);
|
console.log('OK'.green);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -29,6 +31,8 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
fs.accessSync(path.join(dirname, 'node_modules/semver/package.json'), fs.constants.R_OK);
|
||||||
|
|
||||||
var semver = require('semver');
|
var semver = require('semver');
|
||||||
var defaultPackage = require('../../install/package.json');
|
var defaultPackage = require('../../install/package.json');
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ function installAll() {
|
|||||||
var prod = global.env !== 'development';
|
var prod = global.env !== 'development';
|
||||||
var command = 'npm install';
|
var command = 'npm install';
|
||||||
try {
|
try {
|
||||||
|
fs.accessSync(path.join(dirname, 'node_modules/nconf/package.json'), fs.constants.R_OK);
|
||||||
|
|
||||||
var packageManager = require('nconf').get('package_manager');
|
var packageManager = require('nconf').get('package_manager');
|
||||||
if (packageManager === 'yarn') {
|
if (packageManager === 'yarn') {
|
||||||
command = 'yarn';
|
command = 'yarn';
|
||||||
|
|||||||
Reference in New Issue
Block a user