shelljs: Cannot set property to of [object String] which has only a getter

Node version (or tell us if you’re using electron or some other framework):6.11

ShellJS version (the most recent version/Github branch you see the bug on):0.7.8

Operating system:windows10

Description of the bug:Cannot set property to of [object String] which has only a getter

Example ShellJS command to reproduce the error: shelljs.rm

gulp.task('clean', () => {
  if (fs.existsSync(resolveCwd('lib'))) {
    shelljs.rm('-rf', resolveCwd('lib'));
  }
});

the error details is: pipeMethods: [ ‘cat’,‘exec’,‘grep’, ‘head’, ‘sed’,‘sort’,‘tail’, ‘to’, ‘toEnd’, ‘uniq’ ] cmd cat cmd exec cmd grep cmd head cmd sed cmd sort cmd tail cmd to error TypeError: Cannot set property to of [object String] which has only a getter cmd toEnd cmd uniq

that is to say, the ‘to’ method cannot set property!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

hi @nfischer , I do not mean shelljs change that. I mean other package change the prototype of String makes that[cmd] = shellMethods[cmd].bind(that) throw Cannot set property to of [object String] which has only a getter error.

The package you mean is colorful, right? https://github.com/lepture/colorful