【发布时间】:2023-03-30 04:56:02
【问题描述】:
首先,我试图让我的 azure 应用服务托管我的 create-react-app 并使用它来存储我的代码,减去 node_modules。也就是说,我在搜索后从头开始几次,在这里和其他地方询问,但每次我去推送时,不知何故node_modules继续坚持上传自己。
我的流程是:
git init,然后是touch .gitignore,我的.gitignore 看起来像:
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
node_modules
# production
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
然后我做一个git add .,然后添加我的遥控器,然后是git commit -m "",然后是git push azure master,但无论如何,“node_modules”继续坚持被推送。为什么?
如果我做一个git status,你可以看到它并没有显示node_modules目录,那为什么还要继续往上推呢?这里的图片展示了git status的结果:
再次,我已经完成了 3-4 次完全重置,每次问题都相同。你可以看到here,我认为我通过另一篇帖子找到了解决方案,但尽管采取了这些措施,但结果仍然相同。我应该做点别的吗?
更新:
按照第一个答案进行了尝试,一切看起来都很好,但随后又以node_modules 开头。您可以在屏幕截图中看到此处发生的情况:
有什么想法吗?这个最初是使用create-react-app 构建的,当它遇到默认脚本或其他东西时似乎正在发生一些事情。进一步的想法?
【问题讨论】:
标签: node.js git azure azure-web-app-service node-modules