Home > Enterprise >  Visual Studios create Standalone Javascript React Project. npm ERR! code ENOENT npm ERR! syscall ope
Visual Studios create Standalone Javascript React Project. npm ERR! code ENOENT npm ERR! syscall ope

Time:06-22

When trying to create a new Standalone Javascript React Project in Visual Studios 2020, as I have many times before on other computers, I am getting this Error that it can't find package.json.

I have tried npm init, npm uninstall then reinstall, also uninstalling and reinstalling create-react-app.

I have tried this in my main folder and at path C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE

To try and create package.json all with no success.

This should just default create, any ideas?

Edit: It creates this empty project Empty Project Also if I separately use npx create-react-app it works fine.

CodePudding user response:

Ok, I didn't quite understand your problem but try this.

  1. First,

    npm init -y 
    

    in the terminal. This will create a package.json file.

  2. Second, create an index.js file in the same directory where you type in your code.

  3. Third, Go to package.json file and add a script "start":"node index.js"then, go to the terminal and type npm start. or, you can just do node index.js in the terminal without adding script in package.json.

CodePudding user response:

To get it to work I found where one of the package.json files was and copy and pasted it to C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE. For now, it seems to be working if anyone comes behind me and gets as fed up as I have.

  • Related