Parcel Build not running (404)

Hi all - I have a problem running my build. It works fine if I run from VSCode with ‘npm run start’, but if I create a build and try and run on a server, I get a 404 error.

Here is the build:

https://www.resetgames.co.uk/files/bulldroids/dist/

This is the Parcel template I used to setup:

And here is the build output:

PS C:\xampp\htdocs> npm run build

bulldroids@0.0.1 build
parcel build src/index.html --out-dir dist

  • Building…parcel-plugin-clean-easy: C:\xampp\htdocs\dist has been removed.
    √ Built in 1.13s.

dist\Bulldroids.93c342e6.js.map :bangbang: 8.51 MB 248ms
dist\Bulldroids.93c342e6.js :bangbang: 1.02 MB 436ms
dist\index.html 146 B 6ms

Try

parcel build src/index.html --out-dir dist --public-url ./

Unfortunately, that doesn’t work. I get this:

parcel : File C:\Program Files\nodejs\parcel.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies
at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • parcel build src/index.html --out-dir dist --public-url ./
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    
    

I should add that I have no knowledge at all with Execution_Policies, never had to look at them.

That’s strange. You’re still in the right directory?

Yep -

PS C:\xampp\htdocs> parcel build src/index.html --out-dir dist --public-url ./

And it builds without error if you remove --public-url ./?

You can try --public-url './' I guess.

In the package.json, the build commands are:

“scripts”: {

"start": "parcel src/index.html -p 8000",

"build": "parcel build src/index.html --out-dir dist",

But if I just enter this in the terminal: “parcel build src/index.html --out-dir dist”, I get the same security error.

Just adding the public-url now to the json to try

So I amended the json to this:

“scripts”: {
“start”: “parcel src/index.html -p 8000”,
“build”: “parcel build src/index.html --out-dir dist --public-url ./”,

And it loads, albeit with a couple of image load errors, which you can see here:

https://www.resetgames.co.uk/files/bulldroids/dist/

Actually, I think I know what is causing the errors, so I can fix those.

So, all sorted.

Thank you Samme - you are a lifesaver :slight_smile:

1 Like