A React project created in a folder ending with "!" symbol throws an error on start


(Tigran Harutyunyan) #1

What I Wanted to Do

I created a react project and when I tried running it it throws an error.
I figured out the problem and I just want to report on it.

  1. Created the project
    some folder\projects\zappi!\zappi>npm start

as you can see there is a ! symbol after zappi, which didn’t cause any problem while creating the project.

  1. tried running

npm start
it threw an error

react-scripts start

Failed to compile.

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration.module.rules[2].oneOf[1].include should be one of these:
    RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? } | [RegExp | string | function | [(recu
    rsive)] | object { and?, exclude?, include?, not?, or?, test? }]
    -> One or multiple rule conditions
    Details:
    • configuration.module.rules[1].include should be an instance of RegExp
    • configuration.module.rules[1].include: The provided value “…\zappi!\zappi\src” contains exclamat
      ion mark (!) which is not allowed because it’s reserved for loader syntax.
    • configuration.module.rules[1].include should be an instance of function
    • configuration.module.rules[1].include should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    • configuration.module.rules[1].include should be an object.
    • configuration.module.rules[1].include should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    • configuration.module.rules[2].oneOf[1].include should be an instance of RegExp
    • configuration.module.rules[2].oneOf[1].include: The provided value “…\zappi!\zappi\src” contains
      exclamation mark (!) which is not allowed because it’s reserved for loader syntax.
    • configuration.module.rules[2].oneOf[1].include should be an instance of function
    • configuration.module.rules[2].oneOf[1].include should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]
    • configuration.module.rules[2].oneOf[1].include should be an object.
    • configuration.module.rules[2].oneOf[1].include should be an array:
      [RegExp | string | function | [(recursive)] | object { and?, exclude?, include?, not?, or?, test? }]

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! zappi@0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zappi@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! …\AppData\Roaming\npm-cache_logs\2019-02-23T19_58_06_028Z-debug.log

when I remove the “!” symbol it runs perfectly fine.

What Happened Instead

Reproduction Steps

just create a folder with a “!” symbol in the path, create a react project inside of it and try running it. I tried it only for react.

Details

This is not critical. I just want to let you know.

Platform Info

$ npm --versions
6.4.1
<!-- paste output here -->
$ node -p process.platform
win32
<!-- paste output here -->

(John Gee) #2

Fun with paths! Good digging.

That looks like an error in the commands run by the start script rather than a bug in npm.

To confirm, you can try running the commands directly without npm. You can list the scripts with npm run (or look in package.json at the scripts field).

(In which case this topic could go to the #community:javascript category.)