fermyon / spin-js-sdk

https://developer.fermyon.com/spin/javascript-components
Apache License 2.0
52 stars 18 forks source link

Spin build fails when using the one of the templates from spin-js-sdk #83

Closed bindea-mihai closed 1 year ago

bindea-mihai commented 1 year ago

Steps to reproduce

Result: When running spin build for the 2nd time you get the following error image

Workaround

In order to build your app for the 2nd time, you need to manually delete the following folders: -p, dist and target

Other info:

OS: Windows 11 Pro, Version 10.0.22621 Build 22621 Spin: 0.7.1 (6cf7447 2022-12-19) Spin plugin: js2wasm 0.1.0

karthik2804 commented 1 year ago

Thanks for identifying this issue. This issue seems to be isolated to windows due to the lack of a -p argument on mkdir. I will look into it.

karthik2804 commented 1 year ago

It looks like npm by default uses cmd.exe. One solution would be to configure npm to use git bash using the following command.

npm config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe"  

Let me know if that fixes it.

bindea-mihai commented 1 year ago

Worked like a charm. One mention though, git is installed in C:\\Program Files\\git\\bin\\bash.exe

bindea-mihai commented 1 year ago

That also explains why the -p folder was created

itowlson commented 1 year ago

@karthik2804 Is the -p really needed there? It seems to be creating only one level of directory.

karthik2804 commented 1 year ago

@itowlson On Unix systems it let's the command run without failing if the directory already exists.

-p, --parents no error if existing, make parent directories as needed, with their file modes unaffected by any -m option
itowlson commented 1 year ago

TIL! Thanks Karthik!

karthik2804 commented 1 year ago

Can we close this issue @bindea-mihai

tpmccallum commented 1 year ago

Docs have also been updated Re: this issue. https://github.com/fermyon/developer/pull/299 Thanks @bindea-mihai for raising this also.