Sky
Sky

Reputation: 7711

SailsJS - Static files can not be loaded

I learned that the static files placed inside assets will be accessed directly in browser. But after I did this, my static files can't be accessed.

Finally, it turns out that the statics files are not compiled into the hidden folder(.tmp/public). It did work after I copied all the files into this hidden folder manually.

But why isn't it be done automatically? Even after I restarted my application, which has the script starting it with sails lift.

Upvotes: 0

Views: 230

Answers (1)

Sky
Sky

Reputation: 7711

It turns out to be a silly mistake that the server doesn't have the permission to operate .tmp/public folder. As I need to debug the backend code (NodeJS), so I started the server with debug mode in Visual Studio Code. Which I didn't notice the permission error message as it prints lots of logs to make it invisible in current window.

It works as I started the server in command line with sudo node app.js.

Upvotes: 1

Related Questions