can not setup ReactJS on mac

淺唱寂寞╮ 提交于 2020-02-08 07:40:20

问题


I need to setup ReactJS on my Mac. I have npm version of 4.1.2 and node version of v7.7.4. I clone the project from Git and in the project folder trying to execute npm install and following npm start. But I get error. I removed&uninstalled node and npm and then re-installed with homebrew, but it did not help. Here is the screen of error I get in terminal? Do you have any idea what is the problem?

Here is my package.json file

{
  "name": "viaopt",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {},
  "devDependencies": {
    "webpack": "^2.3.0"
  },
  "description": ""
}

回答1:


From the error you are showing I can tell that there is no start script in your package.json file. For npm start to work there should be a command under the start key under the scripts attribute in your package.json file.

When you run npm start npm looks in package.json and runs whatever is listed there under the start value.

I'm guessing you have gulp or webpack configured with your project?

Try running webpack in your terminal and see if your project fires up or smth.

Hopes this helps. Cheers.




回答2:


If your trying to setup a new React App you can use Create React App. It will setup React / Webpack for you.



来源:https://stackoverflow.com/questions/42949940/can-not-setup-reactjs-on-mac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!