Error on npm run build with create-react-app

1.1k views Asked by At

I built a small react app using the create-react-app boiler plate. When serving the content with npm run everything works fine.

But now I tried running the builder for the first time because I am at a point where I would like to show a demo. I tried running npm run build but it errors out. Here is the npm log:

0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ] 2 info using [email protected] 3 info using [email protected] 4 verbose config Skipping project config: /Users/falks/.npmrc. (matches userconfig) 5 verbose stack Error: ENOENT: no such file or directory, open '/Users/falks/package.json' 5 verbose stack at Error (native) 6 verbose cwd /Users/falks 7 error Darwin 15.6.0 8 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build" 9 error node v5.1.1 10 error npm v3.3.12 11 error path /Users/falks/package.json 12 error code ENOENT 13 error errno -2 14 error syscall open 15 error enoent ENOENT: no such file or directory, open '/Users/falks/package.json' 15 error enoent This is most likely not a problem with npm itself 15 error enoent and is related to npm not being able to find a file. 16 verbose exit [ -2, true ]

It appears that it is looking for a package.json outside of my development folder? Any hint how to get the builder to run?

Thank you.

1

There are 1 answers

0
Lucas Kellner On

I think you may be in the wrong folder because of this line in your error

ENOENT: no such file or directory, open '/Users/falks/package.json'

You need to run that command from the same folder that the package.json file is - typically the root folder of your project... it looks like you are trying to run it from your home folder.

-- edited: lol, why did I respond to a question that is over a year old and Dan Abramov already answered - please ignore me