我尝试在 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: …Run Code Online (Sandbox Code Playgroud) 我正在闪存驱动器 E 上使用 node v11.5 和 npm 6.4.1,在 win 7 上,我正在尝试安装最新的 netlify cli。在https://cli.netlify.com/getting-started之后,我有:
$ npm install netlify-cli -g
npm ERR! code EINVAL
npm ERR! EINVAL: invalid argument, read
Run Code Online (Sandbox Code Playgroud)
错误日志显示了几乎相同的内容:
12961 verbose stack Error: EINVAL: invalid argument, read
12961 verbose stack at E:\nodejs\node_modules\npm\node_modules\gentle-fs\lib\rm.js:245:7
12961 verbose stack at E:\nodejs\node_modules\npm\node_modules\gentle-fs\node_modules\iferr\index.js:13:50
12961 verbose stack at E:\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
12961 verbose stack at FSReqCallback.oncomplete (fs.js:161:5)
12962 verbose cwd E:\myproj
12963 verbose Windows_NT 6.1.7601
12964 verbose argv "E:\\nodejs\\node.exe" "E:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "netlify-cli" "-g"
12965 verbose node v11.5.0 …Run Code Online (Sandbox Code Playgroud) 我一生都无法弄清楚这一点。以下站点托管在 Netlify 上并启用了预渲染。检查页面时,所有 OG 标签都是正确的。这些标签是使用 react-helmet 注入的。
https://browniepoints.africa/opportunities/volunteer-at-a-soup-kitchen-every-week-on-thursdays
在 Facebook 调试器上抓取上述 URL 时,它会响应:
The following required properties are missing: og:url, og:type, og:title, og:image, og:description, fb:app_id
Run Code Online (Sandbox Code Playgroud)
唯一应该存在的错误/警告之一是app_id,我不在乎。
我已经等了 48 多个小时才清除缓存,我尝试使用附加到 URL 的查询字符串进行抓取,并且图像具有绝对 URL。但即使是描述标签也没有通过。
请使用 react-helmet 和 Netlify 的人对这个问题有明确的认识吗?
我构建了一个 Gatsby 站点,该站点使用我从 npm 包“google-maps-react”中获取的 google maps 组件。在我的本地环境中一切正常,但是当我部署到 Netlify 时,我收到“Google Maps JavaScript API 错误:InvalidKeyMapError”。
我完成了确保我的 API 密钥已正确注册和激活的所有步骤。我确保在 Netlify UI 中将 API 密钥声明为环境变量,并在我的组件中使用“process.env.GOOGLE_API_KEY”访问它。
import React from "react"
import { Map, InfoWindow, Marker, GoogleApiWrapper } from "google-maps-react"
export class MapContainer extends React.Component {
render() {
return (
<Map google={this.props.google} zoom={14} initialCenter={{lat:37.769461, lng:-122.251831}}>
<Marker onClick={this.onMarkerClick} name={"Current location"} />
<InfoWindow onClose={this.onInfoWindowClose}>
<div>
...some code
</div>
</InfoWindow>
</Map>
)
}
}
export default GoogleApiWrapper({
apiKey: (`${process.env.GOOGLE_API_KEY}`)
})(MapContainer)
Run Code Online (Sandbox Code Playgroud)
从我读过的内容来看,我需要在 Netlify UI 中声明 GOOGLE_API_KEY 环境变量才能访问它,但我显然错过了一些东西。任何帮助表示赞赏,谢谢
我有 3 个独立的函数,每个函数都在它们自己的文件夹中。它们都使用 Twilio 客户端和 Apollo 客户端分别处理 SMS 和 GraphQL 服务器。
与其在每个文件中都拥有实例化每个客户端(从 env 等获取密钥)的所有代码,不如将它放在某个地方并需要它?
我尝试将代码放入顶级函数/文件夹中的 .js 文件中,并在函数代码中要求它,如下所示,这在本地运行良好,netlify dev但Module not found '../twilioClient'在实时环境中调用函数时出错。
/functions
apolloClient.js
twilioClient.js
package.json - specifying deps used by above files
/auth
auth.js - require('../apolloClient')
...
/trails
trails.js - require('../twilioClient') etc.
...
Run Code Online (Sandbox Code Playgroud) 什么是 Netlify nitro 部署?我现在在我的部署日志中看到了这一点,但他们的文档中没有解释这是做什么的:
11:37:18 AM: [feature enabled]: Nitro deploys enabled. Buckle up! ??
我通过 netlify 创建了一个托管在 www.example.com 的前端。前端对 AWS 上托管的负载均衡器地址进行 API 调用。通过Netlify,我设置了一条A记录,让server.example.com指向负载均衡器。在 Amazon Certificate Manager 中,通过在 Netlify 中创建 CNAME 记录,我成功地为 example.com 和 server.example.com 导入了证书。
但是,当我在浏览器中访问 server.example.com 时,它正确加载了我的 Express Server,但Not Secure尽管通过 https 提供服务,但它在浏览器中显示。它说证书无效。
我想知道如何使证书在 server.example.com 上有效 - 任何帮助将不胜感激,因为我已经为此苦苦挣扎了两天。
谢谢!
我一直致力于实现Next 9.3 的一些更新。我一直在移动getInitialProps,getServerSideProps并注意到我exportPathMap对这些页面变得动态变得不满意。运行一切正常next,但是当我去运行时next build && next export,我遇到了一些问题。
在文档的静态HTML导出它指出If your pages don't have getInitialProps you may not need next export at all; next build is already enough thanks to Automatic Static Optimization.我能得到那个工作愉快地与我的新getServerSideProps电话,当我运行next build && next start。我需要采取哪些步骤才能使其也适用,next export以便我可以通过 Netlify 进行部署。这是我尝试运行时遇到的错误示例next export
Error occurred prerendering page "/videos/[videos_title]". Read more: https://err.sh/next.js/prerender-error:
Error: Error for page /videos/[videos_title]: pages with `getServerSideProps` can not …Run Code Online (Sandbox Code Playgroud) 我有一个在本地运行良好的 Nuxt 应用程序。当我将它部署到 Netlify(yarn generate自动运行的地方)时,我注意到发生了一些奇怪的 CSS 事情。
我有一张带有悬停效果的卡片:
<style lang="scss" scoped>
.gallery-card {
align-items: center;
background: url('/backgrounds/image-1.jpg') no-repeat center center;
background-size: cover;
cursor: pointer;
display: flex;
flex-direction: column;
height: 400px;
justify-content: center;
position: relative;
max-width: 100%;
.overlay {
background-color: rgba(255, 255, 255, 0.3);
bottom: 0;
left: 0;
opacity: 0%;
position: absolute;
right: 0;
top: 0;
transition: 0.2s all ease-in-out;
visibility: hidden;
}
.gallery-title {
color: white;
text-shadow: 3px 3px rgba(0, 0, 0, 0.25);
transition: 0.2s all ease-in-out;
} …Run Code Online (Sandbox Code Playgroud) 网站构建位于https://5efbc255ca51be00080b5219--epic-raman-086510.netlify.app/。看起来 javascript 没有运行,并且只显示 html 版本(应该只显示给搜索引擎)。
看起来它可能只是主页。您可以访问theWebsiteBuildLink/publications,或theWebsiteBuildLink/publications查看它适用于其他页面。
我注意到浏览器顶部的选项卡无限显示加载动画
更新
所以它与作为广告的图像有关。这些组件被命名为诸如此类AdImg,并位于名为 ads 的文件夹中。我禁用了广告拦截器,但由于某种原因,这个问题一直在发生。我将名称从“广告”更改为代码字,突然一切都正确加载了。
只是因为无法加载名为“广告”的图像,我网站上的每个图像都无法加载,这仍然令人担忧。谁能回答
netlify ×10
gatsby ×2
javascript ×2
reactjs ×2
aws-lambda ×1
build ×1
code-sharing ×1
deployment ×1
firebase ×1
github-pages ×1
https ×1
next.js ×1
node.js ×1
npm ×1
nuxt.js ×1
prerender ×1
react-helmet ×1
react-router ×1
serverless ×1
ssl ×1
static-site ×1
vue.js ×1