question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@sveltejs/adapter-static: copyfile favicon.ico not permitted (npm run build)

See original GitHub issue

Describe the bug I developed an app and it worked with npm run dev. If I try to build it with npm run build, I get the error: EPERM: operation not permitted, copyfile 'C:\Users\Patrick\dev\internal\rust-jungle\static\favicon.ico' -> 'build\favicon.ico'

I also tried running a terminal with admin permissions, but it results in the same error.

Logs Please include browser console and server logs around the time this bug occurred.

To Reproduce Create a new SvelteKit project, use the adapter-static, replace the favicon and try a npm run build.

Expected behavior A clear and concise description of what you expected to happen. build succeeds without any errors.

Stacktraces If you have a stack trace to include, we recommend putting inside a <details> block for the sake of the thread’s readability:

EPERM: operation not permitted, copyfile 'C:\Users\Patrick\dev\internal\rust-jungle\static\favicon.ico' -> 'build\favicon.ico'
> Using @sveltejs/adapter-static
> EPERM: operation not permitted, copyfile 'C:\Users\Patrick\dev\internal\rust-jungle\static\favicon.ico' -> 'build\favicon.ico'
Error: EPERM: operation not permitted, copyfile 'C:\Users\Patrick\dev\internal\rust-jungle\static\favicon.ico' -> 'build\favicon.ico'
    at Object.copyFileSync (node:fs:2797:3)
    at copy (file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/kit/dist/chunks/utils.js:39:15)
    at file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/kit/dist/chunks/utils.js:35:18
    at Array.forEach (<anonymous>)
    at copy (file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/kit/dist/chunks/utils.js:34:33)
    at Object.copy_static_files (file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/kit/dist/chunks/index5.js:290:4)
    at adapt (file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/adapter-static/index.js:14:10)
    at adapt (file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/kit/dist/chunks/index5.js:322:8)
    at file:///C:/Users/Patrick/dev/internal/rust-jungle/node_modules/@sveltejs/kit/dist/cli.js:616:11

Information about your SvelteKit Installation:

Diagnostics

System: OS: Windows 10 10.0.19043 CPU: (4) x64 Intel® Core™ i5-6500 CPU @ 3.20GHz Memory: 8.66 GB / 15.96 GB Binaries: Node: 16.1.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD npm: 7.5.2 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.964.0), Chromium (90.0.818.62)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
C0ZENcommented, May 29, 2021

FYI I had the same issue because:

  • I build without a favicon
  • I added one and rebuild
  • Faced the issue due to the favicon folder

So, I deleted the build folder and then rebuild and now the issue is gone. I added a script anyway to always remove the build folder before a build.

0reactions
Lucas-Pichettecommented, Dec 7, 2021

Getting the same issue:

Run npm run preview to preview your production build locally.

> Using @sveltejs/adapter-static
> 404 /favicon.ico (linked from /)
Error: 404 /favicon.ico (linked from /)
    at file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/chunks/index4.js:86:11        
    at visit (file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/chunks/index4.js:222:5)    at async visit (file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/chunks/index4.js:293:6)
    at async prerender (file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/chunks/index4.js:303:6)
    at async Object.prerender (file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/chunks/index4.js:368:4)
    at async adapt (file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/adapter-static/index.js:13:4)
    at async adapt (file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/chunks/index4.js:393:2)
    at async file:///C:/Users/Lucas%20Pichette/Desktop/Projects/websites/3.CodeFox-ClientWebsites/lolomcdart/svelteproject/lolomcdart/node_modules/@sveltejs/kit/dist/cli.js:896:5

Seems that favicon.ico folder isn’t being populated with the default favicon.ico that exists at the root of the static folder. Instead, favicon.ico is placed at the project root (/). Which I would think would be preferred? Screenshot 2021-12-07 115318

Read more comments on GitHub >

github_iconTop Results From Across the Web

React app does not show favicon after build - Stack Overflow
I created my react app with create-react-app. When using npm start it works fine. enter image description here.
Read more >
favicons - npm
Favicons generates its icons locally using pure Javascript with no external dependencies. Please note: Favicons is tested on Node 14 and ...
Read more >
ico "Sorry, this file type is not permitted for security reasons"
I'm trying to upload my favicon. It is favicon.ico and I'm getting an error message that says "Sorry, this file type is not...
Read more >
.ico files not uploading to WP 5.5.3 | WordPress.org
[This thread is closed.] Hi, I got this error: “Sorry this file type is not permitted for security reasons” when i uploaded a...
Read more >
Favicon Not Showing Up - How to Fix In Chrome, Wordpress ...
How to Install Favicons Correctly · Upload the favicon.ico file to the desired directory on your site. · Insert this code into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found