Skip to content

Commit 0bbd303

Browse files
committed
fix: resolve folder that is passed in
Root cause of npm/cli#613
1 parent f315830 commit 0bbd303

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = BB.promisify(binLinks)
1818

1919
function binLinks (pkg, folder, global, opts, cb) {
2020
pkg = normalize(pkg)
21+
folder = path.resolve(folder)
2122

2223
// if it's global, and folder is in {prefix}/node_modules,
2324
// then bins are in {prefix}/bin

test/link-bins.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ t.test('foo package cannot link, pre-existing stuff there', t => {
7777
})
7878

7979
t.test('foo package can link with --force link', t => {
80-
const foo = resolve(me, 'node_modules/foo')
80+
const cwd = process.cwd()
81+
t.teardown(() => process.chdir(cwd))
82+
process.chdir(me)
83+
const foo = 'node_modules/foo'
8184
mkdirp(foo)
8285
const pkg = {
8386
name: 'foo',

0 commit comments

Comments
 (0)