DEV Community

Discussion on: Create Your Own React Template

Collapse
 
nezlobnaya profile image
Vlad Burlutskiy • Edited

I followed your steps but somehow I keep getting this message. Getting stuck there:

Error: ENOENT: no such file or directory, stat '/Users/vladislavburlutskiy/Documents/Lambda/my-app/gitignore'
    at Object.statSync (fs.js:1086:3)
    at Object.statSync (/Users/vladislavburlutskiy/Documents/Lambda/my-app/node_modules/graceful-fs/polyfills.js:307:34)
    at statSync (/Users/vladislavburlutskiy/Documents/Lambda/my-app/node_modules/fs-extra/lib/util/stat.js:10:52)
    at getStatsSync (/Users/vladislavburlutskiy/Documents/Lambda/my-app/node_modules/fs-extra/lib/util/stat.js:24:19)
    at Object.checkPathsSync (/Users/vladislavburlutskiy/Documents/Lambda/my-app/node_modules/fs-extra/lib/util/stat.js:49:33)
    at Object.moveSync (/Users/vladislavburlutskiy/Documents/Lambda/my-app/node_modules/fs-extra/lib/move-sync/move-sync.js:14:28)
    at module.exports (/Users/vladislavburlutskiy/Documents/Lambda/my-app/node_modules/react-scripts/scripts/init.js:273:8)
    at [eval]:3:14
    at Script.runInThisContext (vm.js:133:18)
    at Object.runInThisContext (vm.js:310:38) {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: '/Users/vladislavburlutskiy/Documents/Lambda/my-app/gitignore'
}

Aborting installation.
  node  has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
npm ERR! code 1
npm ERR! path /Users/vladislavburlutskiy/Documents/Lambda
npm ERR! command failed
npm ERR! command sh -c create-react-app "my-app" "--template" "astra"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vladislavburlutskiy/.npm/_logs/2021-02-13T17_51_18_481Z-debug.log
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jimmymcbride profile image
Jimmy McBride

Looks like it can't find gitignore, do you have a dot in front of it?

Collapse
 
nezlobnaya profile image
Vlad Burlutskiy

I don't, Jimmy. Obviously, there is something else

Thread Thread
 
jimmymcbride profile image
Jimmy McBride

Check the path that your gitignore file is compared to where the error says it isn't. The error is obviously trying to tell you what's wrong.

Collapse
 
jimmymcbride profile image
Jimmy McBride • Edited

If you have a .gitignore delete the dot and do just gitignore maybe?

Collapse
 
michelangelo17 profile image
Michelangelo Markus

Error: ENOENT: no such file or directory, stat '/Users/vladislavburlutskiy/Documents/Lambda/my-app/gitignore'

This is your error. No such file as gitignore

.gitignore !== gitignore

Check the file name.

Collapse
 
nezlobnaya profile image
Vlad Burlutskiy

I know, somehow cra is not adding the dot in front of gitignore

Thread Thread
 
jimmymcbride profile image
Jimmy McBride

Can you push your code to GitHub so I can check it out? I've never encountered this error myself, so I don't have a quick solution. But if I can see you code maybe I'll have a better idea.

Thread Thread
 
nezlobnaya profile image
Vlad Burlutskiy

I found the bug and fixed it already.

Thread Thread
 
jimmymcbride profile image
Jimmy McBride

What was it?

Thread Thread
 
nezlobnaya profile image
Vlad Burlutskiy

I initially had gitignore outside the template folder and npm published it as such. Then I fixed that and moved it inside the template folder, however I didn't npm publish an updated version.

Thread Thread
 
jimmymcbride profile image
Jimmy McBride

Ah! That makes sense! Yeah, once you said the dot wasn't in front of it, that's what I figured. Forgetting to publish my changes has got me a time or two as well! Glad you got it figured out!

Thread Thread
 
nezlobnaya profile image
Vlad Burlutskiy

I also created a separate repo for my cra template:
github.com/nezlobnaya/cra-template...

Thread Thread
 
nezlobnaya profile image
Vlad Burlutskiy

and I added an alias (alias create-react-app-custom="npx create-react-app --template=file: path/to/folder) to my .zshrc file to quickly run it locally