Context:
I've migrated my Gatsby project to the latest Gatsby Version 4 and use the new gatsby-plugin-image rather than the deprecated gatsby-image.
When I deployed to Netlify, I kept getting the same error below. However, in local development, everything is working.
Error: ENOENT: no such file or directory, open '/opt/build/repo/.cache/caches/gatsby-source-contentful/xxsdfhsdkfh/myimage.png
What I've tried ( didn't fix the problem sadly)
Click the "Clear cache and deploy site" in Netlify
Deleted the .cache and public folder and gatsby build,
Updated some files and pushed the changes again
Version / Dependencies
"gatsby": "^4.0.1",
"gatsby-source-contentful": "6.0.0",
"gatsby-source-filesystem": "^4.0.0",
"gatsby-source-graphql": "^4.0.0",
"gatsby-plugin-netlify": "3.14.0",
"gatsby-plugin-image": "^2.0.0",
.. more
THANK YOU FOR YOUR HELP!!!
Keeping in mind the path that is prompting the error (.cache):
Error: ENOENT: no such file or directory, open
'/opt/build/repo/.cache/caches/gatsby-source-contentful/xxsdfhsdkfh/myimage.png
I'd try to run a fresh deploy clicking the "Clear cache and deploy site"
Related
I'm developing my own gatsby.js theme (actually I've forked and modified another theme, then created new npm package for it). When I change any theme file in node_modules, for example footer.js, I don't see any changes while running gatsby develop until I delete cache with gatsby clean. In the past (2 years ago) when I was making first changes to my npm module, everything was updating as it should. I must also mention that I've cleaned node_modules and updated all dependencies with yarn to the latest available versions.
For example, I'm making this change:
<p className="text-lead"><b>Last modified</b> {lastUpdate}</p>
to
<p className="text-lead"><b>Last change</b> {lastUpdate}</p>
Then gatsby develop detects change:
success onPreExtractQueries - 0.004s
success extract queries from components - 0.128s
success write out requires - 0.003s
success Re-building development bundle - 0.198s
success Writing page-data.json and slice-data.json files to public directory - 0.014s - 0/1 73.40/s
But I see no change in the browser window until I run gatsby clean.
Here's part of my gatsby-config.js at root project folder:
...
plugins: [
{
resolve: "#arturthemaslov/gatsby-theme-intro-maslov",
options: {
basePath: pathPrefix,
contentPath: "content/",
showThemeLogo: false,
theme: "gh-inspired",
},
},
...
Also, I've noticed this warning when running gatsby develop:
warn The #arturthemaslov/gatsby-theme-intro-maslov plugin has generated no Gatsby nodes. Do you need it? This could also suggest the plugin is misconfigured.
Maybe that's something to do with this problem? I've also tried ghosting parts of theme plugin by putting theme files into root src folder, but no luck.
Reason why it isn't working is because you shouldn't be modifying anything in the node_modules directory and when you:
I must also mention that I've cleaned node_modules and updated all
dependencies with yarn to the latest available versions.
You just reverted or updated every dependency within the node_modules directory and if you updated to the latest you need to go through every dependency and see if you have any conflicts which you likely do.
Do note you're also using a theme with Gatsby "^2.20.12" and Gatsby is now on version "^5.2.0".
You also mentioned in the comments you're updated the NPM package while the repository source code is dated a few years. Do not think this is a good approach and you should look at building a release and using the Github Action NPM Publish
By default node_modules folder is under the root directory of my Laravel project and it's working fine. I can compile the scripts with npm run dev and there is no error.
However according to the project folder structure, I move node_modules folder into a child folder called backend.
Here, I also moved the files like webpack.mix.js, package.json into backend folder and run npm install again inside it. But I keep my resources and public folders as original and link them with relative path via backend folder.
The folder structure looks like this
Now, if I run npm run dev inside backend folder, it complains many errors like can't resolve '#babel/runtime/regenerator'.
But if I make a symbolic node_modules inside root folder which is linked to backend/node_modules, it works fine and I can compile the scripts without error.
My question is - How can I compile the scripts from child folder without making a symbolic like this?
Probably it doesn't know where node_modules folder is located.
As laravel-mix is based on webpack. I add the modules path inside webpack config as below to make all import knows where the node_modules folder is located.
mix.webpackConfig({
resolve: {
modules : [
path.resolve("./node_modules")
]
}
});
There is no more can't resolve error.
I'm trying to upload my Go app but the problem is that I get an error because I have made modifications to the package files
The imports from Github lie in C:\Users\Myuser\go\pkg\mod but when I try to upload my Go App, Heroku imports from Github instead of uploading the local modified files. Is there any way to upload my local packages instead of importing them when I deploy the app?
You could try building the app with the "-mod vendor" option so it uses the vendored files instead of pulling the git dependencies
go build -mod vendor
I configured 2 workspaces in package.json e.g example and gatsby-theme but later I found I was actually developing a gatsby-starter so I removed the example workspace that depended on the latter workspace from package.json.
I wonder if I moved all files from gatsby-theme/ to the project root directory and overwrote the package.json and other files with gatsby-theme's, does it become a project that could be managed with both npm and yarn?
Using Vue's default scripts:
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
I run "npm run build" it produces the production build in the "dist" directory however in the end it says:
Images and other types of assets were omitted.
I honestly don't understand what to do include them. I don't want to make a specific folder for images and upload so my web server can serve it. Vue should handle the files in its src/assets folder itself.
So far I have found a solution while googling which says to include:
NODE_ENV = PRODUCTION
But it doesn't work either.
Any clues how to get this fixed? I cannot launch a website without including its logo.
I believe that message just means that they are omitted from the file listing displayed in the console during the build.
Nope. They are omitted from build. My page is "broken" if I use npm run build and then serve it through DJango.
Doing npm run serve it will produce the right files in the django's static folders, and then, serving it from django (w npm server stopped) will work.