Netlify:无效的文件名-部署的文件名不能包含#或?人物

时间:2019-03-19 11:40:03

标签: ruby-on-rails netlify

我正在尝试从GitHub上的Netlify上部署我的网站。

但是我遇到以下错误:

11:37:19 AM: failed during stage 'deploying site': Invalid filename 'node_modules/es5-ext/date/#/format.js'. Deployed filenames cannot contain # or ? characters

我试图删除并升级模块es5-ext,但错误仍然存​​在。

2 个答案:

答案 0 :(得分:7)

我不知道我是否为时已晚,但我刚刚遇到了这个问题 这就是我所做的解决了我的问题

  • 基本目录: yourApps
  • 构建命令: CI= npm run build
  • 发布目录: yourApps/build

我在 React 应用程序中使用了 craco,因为我需要它与 Tailwind css 一起使用,我不知道这是否适合您,但该解决方案对我有用

答案 1 :(得分:0)

My first answer is a question: Why are you deploying your node_modules folder? That is generally not needed on static websites: they're used to build the site, but then not needed at runtime, since, well, "runtime" is just "send this file" not "run this code" on the Netlify CDN server. Perhaps you've set your "publish directory" wrong in the site's build & deploy settings and are deploying your source code too, rather than just the finished build?

In case you do for some reason need to deploy node_modules for some reason, you can in general do so. The message is quite clear - don't send filenames with # or ? in them. Those are not valid filenames per the HTTP spec - # is for designating anchors, and everything after the # is used client-side and thus won't map correctly to your file. ? is for denoting query string parameters and similarly won't work as you're intending to read the file whose name contains ? but rather cutting off the filename that the server will (attempt to) serve, before the ? character.