Home > front end >  Rimraf: Glob dependency not found. How do you set `disableGlob=true` in the cli?
Rimraf: Glob dependency not found. How do you set `disableGlob=true` in the cli?

Time:04-09

I'm trying to deploy my nestjs backed on Heroku and whenever it runs the prebuild: rimraf dist command from package.json it encounters this error. I have no idea what glob is but I'm assuming I don't need it... what is the syntax to set disableGlob = true in the cli/scripts?

Current error:

/tmp/build_ceb6e44a/node_modules/rimraf/rimraf.js:42
    throw Error('glob dependency not found, set `options.disableGlob = true` if intentional')
    ^
Error: glob dependency not found, set `options.disableGlob = true` if intentional
    at defaults (/tmp/build_ceb6e44a/node_modules/rimraf/rimraf.js:42:11)
    at rimraf (/tmp/build_ceb6e44a/node_modules/rimraf/rimraf.js:60:3)
    at go (/tmp/build_ceb6e44a/node_modules/rimraf/bin.js:44:3)
    at Object.<anonymous> (/tmp/build_ceb6e44a/node_modules/rimraf/bin.js:68:3)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47
Node.js v17.9.0

Note: Heroku is installing node 17.9.0 when deploying in case it matters

package.json

{
  "scripts": {
    "rimraf": "./node_modules/rimraf/bin.js",
    "prebuild": "rimraf dist"
  },
  "dependencies": {
    "glob": "^7.2.0",
    "rimraf": "^3.0.2"
  }
}

I tried all of the following with no success

"prebuild": "rimraf -o disableGlob=true dist"
"prebuild": "rimraf --options disableGlob=true dist"
"prebuild": "rimraf options.disableGlob=true dist"

I also installed glob as a dependency but it still errors. Any help?

CodePudding user response:

The instructions in the error message regarding setting options apply to use of rimraf as a module from JavaScript.

Since you're using the rimraf CLI, you need to use the CLI's equivalent, which is the -G (--noglob) option (discover all options with rimraf --help):

"prebuild": "rimraf -G dist"
  • Related