mirror of
https://github.com/ershisan99/go-npm.git
synced 2025-12-16 20:59:28 +00:00
fix "EXDEV: cross-device link not permitted, rename 'bin\starlit.exe' ->
'C:\npm\prefix\bin\starlit.exe'"
This commit is contained in:
@@ -47,6 +47,6 @@ describe('verifyAndPlaceBinary()', () => {
|
|||||||
|
|
||||||
verifyAndPlaceBinary('command', './bin', callback);
|
verifyAndPlaceBinary('command', './bin', callback);
|
||||||
|
|
||||||
expect(fs.renameSync).toHaveBeenCalledWith(path.join('bin', 'command'), path.sep + path.join('usr', 'local', 'bin', 'command'));
|
expect(fs.copyFileSync).toHaveBeenCalledWith(path.join('bin', 'command'), path.sep + path.join('usr', 'local', 'bin', 'command'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
const { existsSync, renameSync, chmodSync } = require('fs');
|
const { chmodSync, copyFileSync, existsSync, unlink } = require('fs');
|
||||||
const { getInstallationPath } = require('../common');
|
const { getInstallationPath } = require('../common');
|
||||||
|
|
||||||
function verifyAndPlaceBinary(binName, binPath, callback) {
|
function verifyAndPlaceBinary(binName, binPath, callback) {
|
||||||
@@ -13,7 +13,8 @@ function verifyAndPlaceBinary(binName, binPath, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move the binary file and make sure it is executable
|
// Move the binary file and make sure it is executable
|
||||||
renameSync(join(binPath, binName), join(installationPath, binName));
|
copyFileSync(join(binPath, binName), join(installationPath, binName));
|
||||||
|
unlink(join(binPath, binName));
|
||||||
chmodSync(join(installationPath, binName), '755');
|
chmodSync(join(installationPath, binName), '755');
|
||||||
|
|
||||||
console.log('Placed binary on', join(installationPath, binName));
|
console.log('Placed binary on', join(installationPath, binName));
|
||||||
|
|||||||
Reference in New Issue
Block a user