[Solved for some reason] Environment variables questions

I tried to use chokidar, then I wrote my package.json that:

  "scripts": {
    "start": "browser-sync start --config bs-config2.js & rollup -c -w & chokidar './src/**/*.scss' -c 'npm run bundle-sass'",
    "bundle-sass": "node autobundle.js src"
  },

but I received that:

Error: $SHELL environment variable is not set.
6:15 PM
    at Object.run (/app/node_modules/chokidar-cli/utils.js:17:15)
6:15 PM
    at run (/app/node_modules/chokidar-cli/index.js:215:18)
6:15 PM
    at debounced (/app/node_modules/lodash/index.js:7737:27)
6:15 PM
    at complete (/app/node_modules/lodash/index.js:7697:25)
6:15 PM
    at Timeout.delayed [as _onTimeout] (/app/node_modules/lodash/index.js:7707:11)
6:15 PM
    at ontimeout (timers.js:488:11)
6:15 PM
    at tryOnTimeout (timers.js:323:5)
6:15 PM
    at Timer.listOnTimeout (timers.js:283:5)

So, I tried to add process.env.SHELL… but I don’t know path to shell (・д・)

  1. What value does environment variable SHELL set to?
  2. Can I set it with that "start": "SHELL='path/to/shell' browser-sync start --config bs-config2.js & rollup -c -w & chokidar './src/**/*.scss' -c 'npm run bundle-sass'",?

Thanks!

p.s.
my project is https://glitch.com/edit/#!/boom-crate?path=package.json:6:0

Hi @ShiMeiWo,

I tried to remix your project but I couldn’t get the error message you mentioned. Also, $SHELL seems to be available (you can check it yourself by using the Terminal in the Advanced Options menu).

If you’re still having this issue, can you send me a PM message with the join link to your project?

@etamponi

As you said, I tried to remix my project into new project, but I received same errors still. But an idea flashed when I read your comment:

(you can check it yourself by using the Terminal in the Advanced Options menu).

I executed
npm dedupe
on the Terminal, then many modules were regulated. After that, I got no errors when I ran chokidar.

Thus the issue is solved… But I don’t know why did I have to dedupe my modules.

Anyway, thank you very much!

1 Like

Really interesting behaviour indeed!

Thank you for reaching out and telling how you solved the problem, we’re always striving to make sure the build process is as straightforward and repeatable as possible, but as you can imagine, it’s not always as easy as it sounds :slight_smile: We’ll make sure this issue is tracked so that we can investigate more in the future.

Thanks again!