我发现了一些有些相关的答案,但到目前为止似乎无法解决......
React的新功能(我已经过了)所以不知道 - 我用create-react-app创建了一个新的React应用程序,然后在package.json中添加了Github Pages位{ {3}}
在npm run build
它未能编译。错误如下。我尝试过的事情:
> react-scripts build
Creating an optimized production build...
Failed to compile.
Module not found: Error: Can't resolve 'react' in '/Users/Mac/Sites/cintacks/src'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cintacks@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cintacks@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Mac/.npm/_logs/2017-06-14T19_52_07_541Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cintacks@0.1.0 predeploy: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cintacks@0.1.0 predeploy script
答案 0 :(得分:0)
鉴于目前的情况,我会尝试:
/Users/Mac/.npm/_logs/2017-06-14T19_52_07_541Z-debug.log
create-react-app
npm start
和/或npm run build
此外:
npm run deploy
吗?/Users/Mac/Sites/cintacks/src
。那里有一个名为react
的文件夹吗?答案 1 :(得分:0)
If anyone else runs into this issue, I managed to fix this by following the command prompts within create-react-app, rather than their github documentation. In the docs, they say to install gh-pages via npm.. but in the command prompt, you're prompted to install via yarn: yarn add --dev gh-pages
then yarn run deploy
. Not entirely sure why the difference but it worked with yarn.