During Heroku Post Build, Cannot find file
This is a react application, with styled components, with a Node backend being deployed to Heroku via git push heroku master
I import the style for each component from a separate file with import {...} from './style'
.
Where the file structure is:
OptionsCarousel
|index.js
|style.js
This makes perfect sense to me, and works locally both via npm start
and npm run build -> serve -s build
. With no issues. But when deploying to Heroku, during the optimization build stage, it fails with the error:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: ./src/OptionsCarousel/index.js
remote: Cannot find file './style' in './src/OptionsCarousel'.
Any advice on a better way to structure this, and what is causing the issue would be greatly appreciated.
javascript reactjs heroku
add a comment |
This is a react application, with styled components, with a Node backend being deployed to Heroku via git push heroku master
I import the style for each component from a separate file with import {...} from './style'
.
Where the file structure is:
OptionsCarousel
|index.js
|style.js
This makes perfect sense to me, and works locally both via npm start
and npm run build -> serve -s build
. With no issues. But when deploying to Heroku, during the optimization build stage, it fails with the error:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: ./src/OptionsCarousel/index.js
remote: Cannot find file './style' in './src/OptionsCarousel'.
Any advice on a better way to structure this, and what is causing the issue would be greatly appreciated.
javascript reactjs heroku
Heroku builds frommaster
as a default (you can deploy from another branch tho). Are you sure that you've added/committed all your files to master and then donegit push heroku master
or however you're deploying your code. FWIW I use the same component structure (CSS modules rather than CSS in JS) and had no issues with pushing to heroku.
– Andy
Dec 28 '18 at 14:54
Thanks @Andy, good to hear that I haven't lost my marbles. I am committing to master and usinggit push heroku master
, I may investigate how heroku caches files, as the entire structure has been changed to accommodate styled-components. So, it may be associated with that.
– Elis Jones
Dec 28 '18 at 15:18
1
Yeah. You can clear the build cache with these instructions. Hope you fix it ok.
– Andy
Dec 28 '18 at 20:55
Cheers @Andy, clearing the cache resolved the issue!
– Elis Jones
Jan 3 at 12:03
add a comment |
This is a react application, with styled components, with a Node backend being deployed to Heroku via git push heroku master
I import the style for each component from a separate file with import {...} from './style'
.
Where the file structure is:
OptionsCarousel
|index.js
|style.js
This makes perfect sense to me, and works locally both via npm start
and npm run build -> serve -s build
. With no issues. But when deploying to Heroku, during the optimization build stage, it fails with the error:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: ./src/OptionsCarousel/index.js
remote: Cannot find file './style' in './src/OptionsCarousel'.
Any advice on a better way to structure this, and what is causing the issue would be greatly appreciated.
javascript reactjs heroku
This is a react application, with styled components, with a Node backend being deployed to Heroku via git push heroku master
I import the style for each component from a separate file with import {...} from './style'
.
Where the file structure is:
OptionsCarousel
|index.js
|style.js
This makes perfect sense to me, and works locally both via npm start
and npm run build -> serve -s build
. With no issues. But when deploying to Heroku, during the optimization build stage, it fails with the error:
remote: Creating an optimized production build...
remote: Failed to compile.
remote:
remote: ./src/OptionsCarousel/index.js
remote: Cannot find file './style' in './src/OptionsCarousel'.
Any advice on a better way to structure this, and what is causing the issue would be greatly appreciated.
javascript reactjs heroku
javascript reactjs heroku
asked Dec 28 '18 at 14:26
Elis JonesElis Jones
8710
8710
Heroku builds frommaster
as a default (you can deploy from another branch tho). Are you sure that you've added/committed all your files to master and then donegit push heroku master
or however you're deploying your code. FWIW I use the same component structure (CSS modules rather than CSS in JS) and had no issues with pushing to heroku.
– Andy
Dec 28 '18 at 14:54
Thanks @Andy, good to hear that I haven't lost my marbles. I am committing to master and usinggit push heroku master
, I may investigate how heroku caches files, as the entire structure has been changed to accommodate styled-components. So, it may be associated with that.
– Elis Jones
Dec 28 '18 at 15:18
1
Yeah. You can clear the build cache with these instructions. Hope you fix it ok.
– Andy
Dec 28 '18 at 20:55
Cheers @Andy, clearing the cache resolved the issue!
– Elis Jones
Jan 3 at 12:03
add a comment |
Heroku builds frommaster
as a default (you can deploy from another branch tho). Are you sure that you've added/committed all your files to master and then donegit push heroku master
or however you're deploying your code. FWIW I use the same component structure (CSS modules rather than CSS in JS) and had no issues with pushing to heroku.
– Andy
Dec 28 '18 at 14:54
Thanks @Andy, good to hear that I haven't lost my marbles. I am committing to master and usinggit push heroku master
, I may investigate how heroku caches files, as the entire structure has been changed to accommodate styled-components. So, it may be associated with that.
– Elis Jones
Dec 28 '18 at 15:18
1
Yeah. You can clear the build cache with these instructions. Hope you fix it ok.
– Andy
Dec 28 '18 at 20:55
Cheers @Andy, clearing the cache resolved the issue!
– Elis Jones
Jan 3 at 12:03
Heroku builds from
master
as a default (you can deploy from another branch tho). Are you sure that you've added/committed all your files to master and then done git push heroku master
or however you're deploying your code. FWIW I use the same component structure (CSS modules rather than CSS in JS) and had no issues with pushing to heroku.– Andy
Dec 28 '18 at 14:54
Heroku builds from
master
as a default (you can deploy from another branch tho). Are you sure that you've added/committed all your files to master and then done git push heroku master
or however you're deploying your code. FWIW I use the same component structure (CSS modules rather than CSS in JS) and had no issues with pushing to heroku.– Andy
Dec 28 '18 at 14:54
Thanks @Andy, good to hear that I haven't lost my marbles. I am committing to master and using
git push heroku master
, I may investigate how heroku caches files, as the entire structure has been changed to accommodate styled-components. So, it may be associated with that.– Elis Jones
Dec 28 '18 at 15:18
Thanks @Andy, good to hear that I haven't lost my marbles. I am committing to master and using
git push heroku master
, I may investigate how heroku caches files, as the entire structure has been changed to accommodate styled-components. So, it may be associated with that.– Elis Jones
Dec 28 '18 at 15:18
1
1
Yeah. You can clear the build cache with these instructions. Hope you fix it ok.
– Andy
Dec 28 '18 at 20:55
Yeah. You can clear the build cache with these instructions. Hope you fix it ok.
– Andy
Dec 28 '18 at 20:55
Cheers @Andy, clearing the cache resolved the issue!
– Elis Jones
Jan 3 at 12:03
Cheers @Andy, clearing the cache resolved the issue!
– Elis Jones
Jan 3 at 12:03
add a comment |
1 Answer
1
active
oldest
votes
As per @Andy's comment, I needed to clear the cache as I had made significant changes to the file structure in the repository. I followed these instructions to do that.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53960033%2fduring-heroku-post-build-cannot-find-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As per @Andy's comment, I needed to clear the cache as I had made significant changes to the file structure in the repository. I followed these instructions to do that.
add a comment |
As per @Andy's comment, I needed to clear the cache as I had made significant changes to the file structure in the repository. I followed these instructions to do that.
add a comment |
As per @Andy's comment, I needed to clear the cache as I had made significant changes to the file structure in the repository. I followed these instructions to do that.
As per @Andy's comment, I needed to clear the cache as I had made significant changes to the file structure in the repository. I followed these instructions to do that.
answered Jan 3 at 12:05
Elis JonesElis Jones
8710
8710
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53960033%2fduring-heroku-post-build-cannot-find-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Heroku builds from
master
as a default (you can deploy from another branch tho). Are you sure that you've added/committed all your files to master and then donegit push heroku master
or however you're deploying your code. FWIW I use the same component structure (CSS modules rather than CSS in JS) and had no issues with pushing to heroku.– Andy
Dec 28 '18 at 14:54
Thanks @Andy, good to hear that I haven't lost my marbles. I am committing to master and using
git push heroku master
, I may investigate how heroku caches files, as the entire structure has been changed to accommodate styled-components. So, it may be associated with that.– Elis Jones
Dec 28 '18 at 15:18
1
Yeah. You can clear the build cache with these instructions. Hope you fix it ok.
– Andy
Dec 28 '18 at 20:55
Cheers @Andy, clearing the cache resolved the issue!
– Elis Jones
Jan 3 at 12:03