Skip to content

Symlink in /static fails build #24865

Closed
Closed
@azhang

Description

@azhang

Description

A javascript library I'm using needs to be available as static files, and is also required in the code. Hence, I put it in src/components/Something/charting_library and symlinked it to static.
This symlink gets served properly in development mode, but cannot be built.

Steps to reproduce

ln -s src/components/Something/charting_library static/
yarn build

Expected result

no errors

Actual result

ERROR 

ENOENT: no such file or directory, stat '/Users/allie/src/blep/website/static/charting_library'



 Error: ENOENT: no such file or directory, stat '/Users/allie/src/blep/website/static/charting_library'
 
 - polyfills.js:307 Object.statSync
   [website]/[graceful-fs]/polyfills.js:307:34
 
 - stat.js:58 getStatsSync
   [website]/[fs-extra]/lib/util/stat.js:58:18
 
 - stat.js:90 Object.checkPathsSync
   [website]/[fs-extra]/lib/util/stat.js:90:33
 
 - copy-sync.js:119 copyDirItem
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:119:29
 
 - copy-sync.js:113 
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:113:39
 
 - Array.forEach
 
 - copy-sync.js:113 copyDir
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:113:23
 
 - copy-sync.js:103 onDir
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:103:10
 
 - copy-sync.js:45 getStats
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:45:37
 
 - copy-sync.js:38 startCopy
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:38:10
 
 - copy-sync.js:33 handleFilterAndCopy
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:33:10
 
 - copy-sync.js:26 Object.copySync
   [website]/[fs-extra]/lib/copy-sync/copy-sync.js:26:10
 
 - get-static-dir.js:38 
   [website]/[gatsby]/dist/utils/get-static-dir.js:38:35
 
 - Array.map
 
 - get-static-dir.js:38 copyStaticDirs
   [website]/[gatsby]/dist/utils/get-static-dir.js:38:4
 

not finished run queries - 0.053s
error Command failed with exit code 1.

Environment

System:
  OS: macOS 10.15.4
  CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  Shell: 5.7.1 - /bin/zsh
Binaries:
  Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node
  Yarn: 1.22.4 - /usr/local/bin/yarn
  npm: 6.9.0 - ~/.nvm/versions/node/v12.2.0/bin/npm
Languages:
  Python: 2.7.16 - /usr/bin/python
Browsers:
  Chrome: 83.0.4103.61
  Firefox: 66.0.3
  Safari: 13.1
npmPackages:
  gatsby: ^2.15.15 => 2.20.14
  gatsby-paginate: ^1.1.1 => 1.1.1
  gatsby-plugin-feed: ^2.3.12 => 2.4.1
  gatsby-plugin-google-tagmanager: ^2.1.9 => 2.2.1
  gatsby-plugin-manifest: ^2.2.16 => 2.3.3
  gatsby-plugin-netlify-cms: ^4.1.15 => 4.2.2
  gatsby-plugin-nprogress: ^2.1.6 => 2.2.1
  gatsby-plugin-offline: ^3.0.6 => 3.1.2
  gatsby-plugin-postcss: ^2.2.1 => 2.2.1
  gatsby-plugin-prefetch-google-fonts: ^1.4.3 => 1.4.3
  gatsby-plugin-react-helmet: ^3.1.7 => 3.2.1
  gatsby-plugin-sharp: ^2.2.22 => 2.5.4
  gatsby-plugin-sitemap: ^2.2.12 => 2.3.1
  gatsby-plugin-svgr: ^2.0.2 => 2.0.2
  gatsby-remark-copy-linked-files: ^2.1.19 => 2.2.1
  gatsby-remark-images: ^3.1.22 => 3.2.2
  gatsby-remark-prismjs: ^3.3.13 => 3.4.1
  gatsby-remark-relative-images: ^0.2.3 => 0.2.3
  gatsby-source-filesystem: ^2.1.22 => 2.2.2
  gatsby-transformer-remark: ^2.6.22 => 2.7.1
  gatsby-transformer-sharp: ^2.2.14 => 2.4.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs reproductionThis issue needs a simplified reproduction of the bug for further troubleshooting.type: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions