1

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

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 但没有任何效果

4

2 回答 2

2

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

rm -rf node_module

清洁然后跑

npm install

这似乎有效=)

于 2017-02-07T15:17:27.657 回答
0

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

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

于 2020-01-27T13:02:49.253 回答