zkat / npx

execute npm package binaries (moved)
https://github.com/npm/npx
Other
2.63k stars 105 forks source link

error message: 'TypeError: rimraf.sync is not a function' in version 9.0.7 #61

Closed Teamop closed 7 years ago

Teamop commented 7 years ago
Platform: windows 7
npx: v9.0.7
npm: v5.2.0
node: v6.9.5
shell: CMD.EXE

I have installed the npx globally, then want to try some features, but got the error: 'TypeError: rimraf.sync is not a function'. image

katemihalikova commented 7 years ago

The last issue from Windows trilogy (#60, #58 and #61) 🔱

This is fairly easy to solve: rimraf package is being promisified and the returned function does not have the other properties like sync that were on the original function. Using non-promisified rimraf for this solves the problem.

  : path.join(prefix, 'bin')
- const rimraf = promisify(require('rimraf'))
+ const rimraf = require('rimraf')
  process.on('exit', () => rimraf.sync(prefix))
- return rimraf(bins).then(() => {
+ return promisify(rimraf)(bins).then(() => {
    return installPackages(specs, prefix, opts)
zkat commented 7 years ago

😊 yeah I'll just roll a patch for this. It was p obvs when I saw it.