Vai*_*pta 5 github-pages firebase reactjs react-router netlify
我尝试在 Github-Pages、Firebase、Netlify 上部署我的 django-react 应用程序。使用 gh-pages 在 github-pages 上部署时,出现此错误
sh: 1: gh-pages: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! blog_frontend@0.1.0 deploy: `gh-pages -d build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the blog_frontend@0.1.0 deploy 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! /home/pika/.npm/_logs/2018-08-09T15_30_32_229Z-debug.log
Run Code Online (Sandbox Code Playgroud)
然后尝试使用 Firebase。首先我安装 firebase-tools
npm install -g firebase-tools
Run Code Online (Sandbox Code Playgroud)
然后我无法在目录中初始化 firebase。尝试时
firebase init
Run Code Online (Sandbox Code Playgroud)
它说
firebase: command not found
Run Code Online (Sandbox Code Playgroud)
同样的情况也与 netlify 相同。
这是 gh-pages 错误的日志文件
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using npm@6.2.0
3 info using node@v10.8.0
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle blog_frontend@0.1.0~predeploy: blog_frontend@0.1.0
6 verbose lifecycle blog_frontend@0.1.0~predeploy: unsafe-perm in lifecycle true
7 verbose lifecycle blog_frontend@0.1.0~predeploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pika/Desktop/django/Django-React-Blog/frontend/blog_frontend/node_modules/.bin:/home/pika/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
8 verbose lifecycle blog_frontend@0.1.0~predeploy: CWD: /home/pika/Desktop/django/Django-React-Blog/frontend/blog_frontend
9 silly lifecycle blog_frontend@0.1.0~predeploy: Args: [ '-c', 'npm run build' ]
10 silly lifecycle blog_frontend@0.1.0~predeploy: Returned: code: 0 signal: null
11 info lifecycle blog_frontend@0.1.0~deploy: blog_frontend@0.1.0
12 verbose lifecycle blog_frontend@0.1.0~deploy: unsafe-perm in lifecycle true
13 verbose lifecycle blog_frontend@0.1.0~deploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/pika/Desktop/django/Django-React-Blog/frontend/blog_frontend/node_modules/.bin:/home/pika/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
14 verbose lifecycle blog_frontend@0.1.0~deploy: CWD: /home/pika/Desktop/django/Django-React-Blog/frontend/blog_frontend
15 silly lifecycle blog_frontend@0.1.0~deploy: Args: [ '-c', 'gh-pages -d build' ]
16 info lifecycle blog_frontend@0.1.0~deploy: Failed to exec deploy script
17 verbose stack Error: blog_frontend@0.1.0 deploy: `gh-pages -d build`
17 verbose stack spawn ENOENT
17 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
17 verbose stack at ChildProcess.emit (events.js:182:13)
17 verbose stack at maybeClose (internal/child_process.js:962:16)
17 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:249:5)
18 verbose pkgid blog_frontend@0.1.0
19 verbose cwd /home/pika/Desktop/django/Django-React-Blog/frontend/blog_frontend
20 verbose Linux 4.15.0-29-generic
21 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
22 verbose node v10.8.0
23 verbose npm v6.2.0
24 error file sh
25 error code ELIFECYCLE
26 error errno ENOENT
27 error syscall spawn
28 error blog_frontend@0.1.0 deploy: `gh-pages -d build`
28 error spawn ENOENT
29 error Failed at the blog_frontend@0.1.0 deploy script.
29 error This is probably not a problem with npm. There is likely additional logging output above.
30 verbose exit [ 1, true ]
Run Code Online (Sandbox Code Playgroud)
检查gh-pagespackage.json 文件中是否缺少依赖项。
我知道这已经晚了,但也许它会对解决相同问题的人有所帮助。我最近在发布到 Github Pages 时遇到了类似的错误,我仍然不知道它是如何发生的,但不知何故我的gh-pages依赖项不再安装。我想我可能把它用在废弃的树枝或其他东西上。
只需npm install --save gh-pages在终端中运行就可以恢复我的应用程序......以及我的理智,哈哈。这确实是一个令人恼火的小错误。
我希望这仍然与类似修复中的人相关。
| 归档时间: |
|
| 查看次数: |
1104 次 |
| 最近记录: |