Tag: nextjs

Npm包提供一个Material-UI HOC到一个Nextjs应用程序

问题描述 我正在尝试通过npm包提供Material-UI到Nextjs应用程序。 npm包使用Webpack。 这一切正常,但我得到一个错误消息。 这个东西稍微超出了我对npm packages&webpack的理解,我可能不会这样做,如果是这样的话,请提供build议。 错误消息 警告:上下文types失败: 64a55d578f856d258dc345b094a2a2b3types的上下文64a55d578f856d258dc345b094a2a2b3提供给withStyles(ButtonBase) , Jss预期实例。 警告:上下文types失败:提供给withStyles(TouchRipple)types的SheetsRegistrytypes的无效上下文d4bd0baacbc52bbd48bbb9eb24344ecd ,为withStyles(TouchRipple)预期实例。 重现步骤 这只会让你检查错误。 git clone https://github.com/astenmies/next-library-starter.git && cd next-library-starter && yarn && yarn run dev 调整npm包的步骤 这将让你检查错误,并调整本地运行的npm包。 首先得到npm包并运行它 git clone https://github.com/astenmies/next.js-library.git && cd next.js-library && yarn && yarn run dev 然后在你的terminal的另一个选项卡上,在上述相同的根目录下…获取nextjs应用程序,删除npm包,获取linklocal并运行应用程序。 git clone https://github.com/astenmies/next-library-starter.git && cd next-library-starter && yarn remove next-library && yarn […]

错误:使用Next.js在Heroku上产生EACCES

当我尝试将我的Next.js项目推送到Heroku时,出现以下错误。 它在本地正常工作。 另外我以前的提交在Heroku上工作。 我现在试图将新版本的项目推到Heroku,package.json没有改变,我得到以下错误: remote: Compressing source files… done. remote: Building source: remote: remote: —–> Node.js app detected remote: remote: —–> Creating runtime environment remote: remote: NPM_CONFIG_LOGLEVEL=error remote: NPM_CONFIG_PRODUCTION=true remote: NODE_VERBOSE=false remote: NODE_ENV=production remote: NODE_MODULES_CACHE=true remote: remote: —–> Installing binaries remote: engines.node (package.json): unspecified remote: engines.npm (package.json): unspecified (use default) remote: remote: Resolving node version […]

在NextJs中访问服务器端代码中的静态资源?

我使用NextJS的静态渲染function来生成我的网站的静态版本,因此我想确保在页面的第一次呈现所有需要正确呈现的数据提供。 我有一些博客文章,我已经存储为.md文件在/静态,并希望访问他们在一个页面中,如: import * as fs from "fs"; … export default class extends React.Component<IProps, any> { static async getInitialProps (props: IServerProps) { const post = (await getDb()).posts.find(p => p.id == props.query.id); const markdown = fs.readFileSync(`/static/posts/${post.markdownFileName}`); return { post, markdown } } … 但是,如果尝试运行上面的,我得到以下错误: This dependency was not found: * fs 所以我不知道我应该如何去访问这些静态资源,而在服务器上..

警告:使用Cipheriv作为aes-256-ctr的计数器模式

在terminal有这个警告,有问题追查源或它的实际原因/原因。 (node:37770) Warning: Use Cipheriv for counter mode of aes-256-ctr (node:37770) Warning: Use Cipheriv for counter mode of aes-256-ctr 没有太多的信息提供不幸的。 我明白这是与Node的东西,但不知道如何解决它。 https://nodejs.org/api/crypto.html 节点-v stable 8.9.0 (bottled), HEAD 的package.json "dependencies": { "axios": "^0.17.0", "babel-plugin-wrap-in-js": "^1.1.1", "babel-runtime": "^6.26.0", "body-parser": "^1.18.2", "compression": "^1.7.1", "cookie": "^0.3.1", "dotenv": "^4.0.0", "express": "^4.16.2", "express-session": "^1.15.6", "firebase": "^4.6.0", "firebase-admin": "^5.4.3", "isomorphic-unfetch": "^2.0.0", "js-cookie": […]