无法启动克隆的React应用

时间:2018-07-04 17:44:57

标签: reactjs npm

我刚刚从github克隆了一个React应用到本地计算机,但是当我在其上运行npm start时,出现此错误:

   ➜  sweet-movie-app git:(master) npm start
internal/modules/cjs/loader.js:596
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
    at Function.Module._load (internal/modules/cjs/loader.js:520:25)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:145:3)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)

我不确定这是全局丢失的东西,还是本地存储库或npm出错。 Package.json

{
  "name": "sweet-movie-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "material-ui": "^0.20.0",
    "react": "^16.2.0",
    "react-bootstrap": "^0.32.0",
    "react-dom": "^16.2.0",
    "react-redux": "^5.0.6",
    "react-scripts": "1.1.0",
    "redux": "^3.7.2",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.2.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

3 个答案:

答案 0 :(得分:1)

克隆了git存储库后,请尝试使用npm install从应用程序目录中安装所有模块,以避免此类问题。

答案 1 :(得分:1)

克隆存储库后,从包含 npm install 文件的目录中的终端运行 package.json;这将安装您的应用程序所需的所有依赖项。然后运行 ​​npm start

答案 2 :(得分:0)

克隆存储库时,请从项目目录运行npm install,然后运行npm start。发生这种情况是因为未安装依赖项。