Giter Site home page Giter Site logo

Comments (14)

koriolis avatar koriolis commented on August 9, 2024 2

Not sure if this is the right place for this, but on WSL2 (Ubuntu 18.04) my Svelte/Snowpack project never gets past the first build.
Site seems to work still, but any file changes do not rebuild or refresh the browser.

That's an ongoing issue with WSL2 that is affecting all file watchers currently for files in /mnt/c
If you move the files inside the Linux file system (I moved them to a folder inside ~) the watchers work correctly and as an added bonus you get amazing file i/o performance.

If you don't feel like copying files around on the shell, you can open Windows explorer inside the Linux filesystem by calling the exe directly an passing it a folder path. Example: explorer.exe . for the current folder.

from create-snowpack-app.

koriolis avatar koriolis commented on August 9, 2024

npx create-snowpack-app mydir --template @snowpack/app-template-svelte is also failing for me on Windows 10 WSL Ubuntu and also Windows 10 Powershell, producing a similar error to the above:
(node:344) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, stat '/mnt/c/dev/mydir/node_modules/@snowpack/app-template-svelte'

It's weird that it produces the exact same result on WSL and Powershell.

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

So strange, it definitely seems to be an issue creating this path: C:\home\new-dir.build_dist_\index.js

But the line where that happens is (simplified):

const a = path.join(cwd, `.build`)
const b = path.join(a, '/_dist_');

When I play around with this using path.win32.join, it seems fine. Unfortunately I don't have a windows machine. Any ideas what could be happening?

from create-snowpack-app.

AsaAyers avatar AsaAyers commented on August 9, 2024

Could it be the leading / in /_dist_? Windows uses \ as a separator, which I think is the main thing path.join is there to solve. I think a link to the real code you simplified might also help.

from create-snowpack-app.

david-camdzic avatar david-camdzic commented on August 9, 2024

There seem to be 2 build folders. Also the _dist_ is missing:
screen

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

oh that helps! ".build" is the unbundled site that we the run Parcel on to create the final "build" dir. "dist/" missing seems to be the bigger issue here, which would also be caused by the issue mentioned above.

@AsaAyers it could be the extra "/" but I just tried that with path.win32.join and it handled it fine. That makes me think it's something else, but if you were able to make a quick change and test it locally on your windows machine so that we could confirm, that would be great:

// build.ts
- const distDirectoryLoc = path.join(buildDirectoryLoc, config.devOptions.dist);
+ const distDirectoryLoc = path.join(buildDirectoryLoc, config.devOptions.dist.substr(1));

from create-snowpack-app.

AsaAyers avatar AsaAyers commented on August 9, 2024

It doesn't appear to make any difference. I believe this is the line you're referring to

https://github.com/pikapkg/snowpack/blob/5569b9f5813d6ac694f092c31b5e0ee88fc58768/src/commands/build.ts#L35

Whether I have the .substr(1) or not, they both create the same result:
C:\Users\Asa\Documents\GitHub\snow-worker\.build\_dist_ (no substr)
C:\Users\Asa\Documents\GitHub\snow-worker\.build\_dist_ (.substr(1))

I can also confirm that .build/_dist_ doesn't exist.

I didn't want to go through the whole process of trying to build snowpack myself, so I actually just edited node_modules\snowpack\dist-node\index.js.

from create-snowpack-app.

ervwalter avatar ervwalter commented on August 9, 2024

It's not clear to me if this is a different issue (if it is, let me know and I'll create a separate one), but a similar but slightly different problem with the react-typescript template:

npx create-snowpack-app new-dir --template @snowpack/app-template-react-typescript --use-yarn
cd new-dir
yarn build

results in this error (which is slightly different than the svelte error message):

Snowpack

  .\build Building your application...

  mount:public............[DONE]
  mount:web_modules.......[DONE]
  mount:src...............[DONE]
  lintall:tsc.............[DONE]
  build:ts,tsx,js,jsx.....[DONE]
  build:css...............[DONE]
  build:svg...............[DONE]
  bundle:*................[FAILED]

▼ bundle:*

  ×  No entries found.
      at Bundler.bundle (D:\EpicSource\new-dir\node_modules\parcel-bundler\src\Bundler.js:275:17)
  Error: Command failed with exit code 1: parcel build index.html --out-dir D:\EpicSource\new-dir\build
  ×  No entries found.
      at Bundler.bundle (D:\EpicSource\new-dir\node_modules\parcel-bundler\src\Bundler.js:275:17)

▼ Result

  ⚠️  Finished, with errors.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After the crash, there is a .build/ folder that contains only package.json and an empty build/ folder.

Note, that template works fine on ubuntu 18.04, so in this case it does seem to be Windows specific.

from create-snowpack-app.

ervwalter avatar ervwalter commented on August 9, 2024

See my linked pull request. I debugged tonight and found that build.ts was using glob.sync() to find files and then doing .replace() on the returned file paths using folder paths that came from path.resolve()

glob.sync() returns c:/paths/that/look/like/this on windows and path.resolve() returns c:\paths\that\look\like\this. So the attempt to replace -style paths in the string that had /-style paths was not doing anything and the various copy operations in build.ts were copying the file on top of itself instead if into the .build folder.

I tested this with both the react template and with the svelte templates. Both work now. Note, however, when I tried the svelte template without the fix I was getting a No entries found error and not a ENOENT error as originally reported.

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

THANK YOU! Really appreciate the help debugging on Windows 👍👍👍
With this PR I can do some work to add a basic test suite to make sure that we don't regress on Windows, or if we do that it's obvious which PR/commit did it.

I can't believe that glob returns bad files on Windows, that seems like a huge miss

from create-snowpack-app.

ervwalter avatar ervwalter commented on August 9, 2024

I was surprised too, but it looks like it was intentional based on https://github.com/isaacs/node-glob#user-content-windows

from create-snowpack-app.

FredKSchott avatar FredKSchott commented on August 9, 2024

huh, that's... suprising. Someone else suggested updating to use globby, might be worth pulling the trigger on that if there are other issues like this lurking

from create-snowpack-app.

koriolis avatar koriolis commented on August 9, 2024

from create-snowpack-app.

Bandit avatar Bandit commented on August 9, 2024

Not sure if this is the right place for this, but on WSL2 (Ubuntu 18.04) my Svelte/Snowpack project never gets past the first build.

mount:web_modules [DONE]
mount:public [DONE]
mount:src [DONE]
build:.js,.jsx,.ts,.tsx. [READY]
build:svelte [READY]

Site seems to work still, but any file changes do not rebuild or refresh the browser.

from create-snowpack-app.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.