Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: npm start problem. mdb publish problem

Vlad-Ont free asked 4 years ago


Start working with Getting Started Package. mdb publish - doesn't work. npm start -doesn't work. Error message: react-script not found. Any other create-react project are working well on my computer.

I have npm installed v. 6.13.7 and I am using it intensively. The command "npm start" is very common for me to activate developed applications in Chrome or Firefox browser.

Step-by-step Instruction 1 to replicate:

  1. Downloaded the zip file using "Direct download" option from the page: https://mdbootstrap.com/docs/react/getting-started/download/
  2. Unpackaged the downloaded file "MDB-React-Free-npm.zip"
  3. Navigated to folder "MDB-React-Free-npm"
  4. In Command-Line run "code ." to open VS Code and checked the project files
  5. In embedded VS Code Terminal run "npm start"

RESPONSE:

sh: 1: react-scripts: not found .... 
npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

Alternatively used another way with an attempt to publish: (https://mdbootstrap.com/cli/quick-start/) Instruction 2:

  1. Created project folder, navigated to it and run "npm install -g mdb-cli" (installed mdb-cli@1.1.23 with one warning core-js@2.6.11 is no longer exist)
  2. Created MDB account and logged in using the command: "mdb login"
  3. Initialised project with the command "mdb init", selected option "Material Design for Bootstrap 4 (React)" (success: (Index 0, Status 0) Initialisation completed (Index 1, Status 0) Project metadata saved)
  4. With command "cd React-Template" navigated to the project folder "React-Template"
  5. Opened the project in VS Code with using the command "code .", checked the project files
  6. Attempted to publish with using the command "mdb publish"

RESPONSE:

sh: 1: react-scripts: not found ....
{ Status: 1, Message: 'Problem with project building' }

Your any ideas, comments, or opinion would be highly appreciated. Thank you.


Sebastian Kaczmarek staff commented 4 years ago

Have you run npm install? Could you please post a step-by-step instruction on how to reproduce this error?


Sebastian Kaczmarek staff commented 4 years ago

Your instructions are very helpful, thanks. I have updated the question with your detailed instructions and removed the answer as this wasn't an actual answer (we try to keep the forum similar to SO)


Sebastian Kaczmarek staff commented 4 years ago

Since it doesn't seem to be a problem with the CLI, I will redirect you to someone from the React Team so they could take a look at it ;)


Piotr Glejzer staff commented 4 years ago

You didn't install packages so this is why this error with 'react-scripts' is showing up. Try npm i or yarn and you probably have to upgrade a version a react-scripts to 3.4.0 . React team upgraded a version of scripts to 3.4.0 and versions < 3.4.0 have an error during the bundle.


Vlad-Ont free commented 4 years ago

Hi Piotr, You are absolutely right. I believe, the reason was that "npm i" was not done. Unfortunately, I assumed that it was already installed globally (so stupid...)

But today I made one more serious mistake. As it was message like "react-scripts" not found, by mistake I ran "react-scripts i", and after that many my projects crushed. The error message contains long instruction with different methods such as removing "package-lock.json" file and re-installing npm as well using yarn instead of npm. Struggling but so far no success.

Anyway, thank you for your advise. If you have any idea how to restore the situation it would be appreciated. I believe each project must be reconfigured... but don't know how... Thank you


Piotr Glejzer staff commented 4 years ago

what kind of command did you use? react-scripts i that command doesn't exist in official docs. Did you use eject, maybe?

https://create-react-app.dev/docs/available-scripts/#npm-run-eject



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.25.2
  • Device: Aser
  • Browser: Google Chrome 79.0.3945.88
  • OS: Linux Mint
  • Provided sample code: No
  • Provided link: Yes