【问题标题】:`npm start` not working for my create-react-app application. Missing template?`npm start` 不适用于我的 create-react-app 应用程序。缺少模板?
【发布时间】:2017-06-23 00:07:01
【问题描述】:

我通常只为我的 create-react-app 项目运行 npm start,但在我重新启动计算机后,我无法再执行此操作并收到这个奇怪的错误:

module.js:341
    throw err;
    ^

Error: Cannot find module './Template'
    at Function.Module._resolveFilename (module.js:339:15)
    at Function.Module._load (module.js:290:25)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/Users/richardbustos/Google Drive/workspace/portfolio/node_modules/webpack/lib/MainTemplate.js:8:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.5.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! portfolio@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portfolio@0.1.0 start script 'react-scripts start'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the portfolio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     react-scripts start
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs portfolio
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls portfolio
npm ERR! There is likely additional logging output above.

我尝试运行 npm install 并更新 npm 和 npde 但没有任何效果

【问题讨论】:

  • 我认为问题出在您尝试导入 ./Template 的项目中,但由于路径不正确而失败,请检查。
  • 尝试将你的 npm 和节点版本与样板同步

标签: reactjs npm npm-install create-react-app


【解决方案1】:

啊,找到了解决办法。我所要做的就是:

rm -rf node_module

清理然后运行

npm install

这似乎有效 =)

【讨论】:

    【解决方案2】:

    我在运行 npm start 命令时遇到了同样的问题。

    安装 npm 版本 4.6.1 帮助我解决了这个问题。我希望它对你们中的一些人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-03
      • 2018-12-10
      • 2018-09-06
      • 2019-10-02
      • 2017-02-18
      • 1970-01-01
      • 2020-01-21
      相关资源
      最近更新 更多