Skip to content

Commit c8160d6

Browse files
committed
fix "EXDEV: cross-device link not permitted, rename 'bin\starlit.exe' ->
'C:\npm\prefix\bin\starlit.exe'"
1 parent 87e2c92 commit c8160d6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

__test__/assets/binary.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ describe('verifyAndPlaceBinary()', () => {
4747

4848
verifyAndPlaceBinary('command', './bin', callback);
4949

50-
expect(fs.renameSync).toHaveBeenCalledWith(path.join('bin', 'command'), path.sep + path.join('usr', 'local', 'bin', 'command'));
50+
expect(fs.copyFileSync).toHaveBeenCalledWith(path.join('bin', 'command'), path.sep + path.join('usr', 'local', 'bin', 'command'));
5151
});
5252
});

src/assets/binary.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { join } = require('path');
2-
const { existsSync, renameSync, chmodSync } = require('fs');
2+
const { chmodSync, copyFileSync, existsSync, unlink } = require('fs');
33
const { getInstallationPath } = require('../common');
44

55
function verifyAndPlaceBinary(binName, binPath, callback) {
@@ -13,7 +13,8 @@ function verifyAndPlaceBinary(binName, binPath, callback) {
1313
}
1414

1515
// Move the binary file and make sure it is executable
16-
renameSync(join(binPath, binName), join(installationPath, binName));
16+
copyFileSync(join(binPath, binName), join(installationPath, binName));
17+
unlink(join(binPath, binName));
1718
chmodSync(join(installationPath, binName), '755');
1819

1920
console.log('Placed binary on', join(installationPath, binName));

0 commit comments

Comments
 (0)