Images or JS not showing on Magento 2 installation - javascript

I've just installed Magento 2 onto my production server under a
development. subdomain. The install appeared to have been successful
but I've noticed there are no images or working javascript in both the
frontend and the backend.
After inspecting the source code, I found that files being called in
such as
http://dev.website.com/pub/static/frontend/Magento/luma/en_GB/css/print.css
don't actually exist. Any thoughts? I tried solutions on several
stacks but haven't had any luck.

Try this Before that take Backup
Remove everything, except .htaccess file from pub/static folder
Open up app/etc/di.xml find the path “Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink” and replace to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
Note: Remove entire files and folder under pub/static except .htaccess file.
For More info ref this http://www.dckap.com/blog/magento-2-admin-links-not-working-in-windows/
Other Solution
You can run below command from Magento root folder.
php bin/magento setup:static-content:deploy
This will download the content perfectly in respective folders.

Related

How to deploy to vercel static files? only html, css and js

I found a solution - read my first answer.
I am trying to deploy a repository from my github.
The project contains some static files:
├─js
│ ├─form.js
│ ├─logic.js
│ └─anotherFile.js
├─index.html
└─styles.css
After I deploy the project (without choosing framework - choosing "other") I get 404 (Failed to load resource) when I enter the project from the new domain.
Just to mention, the project works fine locally when I open the index.html file.
Since I used import statements inside my javacsript files it caused some problems when trying to access them when openning the index.html.
I used webpack to solve that issue so I will use the build output. In vercel platform I chose the OUTPUT DIRECTORY option as the relevent build output - dist in my case.
I found what has helped me when deploying static files is creating another folder inside the root directory. And then put all the files in the newly created folder.

How to deploy on apache http server once you have your angular2 application bundled with gulp

I've been wasting a lot of time trying to learn how to deploy angular 2. I tried looking around how to do it on tomcat, because that's what I was ordered to do, but turns out tomcat isn't really used for this, is more java and jsp oriented, so I've read is better to use Apache HTTP server instead.
I just installed Apache server, and I just installed npm with gulp ( https://github.com/swirlycheetah/generator-angular2 ), and everything works fine: I can run my app on localhost:3030 with gulp but I now want to test it with Apache,
I've tried several things (since I haven't seen one single place explaining this, maybe it's a very basic thing to do?):
Configure apache .conf file to change the htdocs to a folder I've created. I've tested this works, I see the result on screen when I access localhost.
Compiled everything, got a folder called build with all my files changed to .js extention, so I figured, that must be it. I copied all the files in there, the lib folder created, and index.html and css files. Doesn't work.
Tried several combinations of picking some files that I figured would be necessary and not others. Doesn't work.
Copied the whole project that I've tested with gulp, with eclipse etc that works, including .ts and .d.ts files, which I've read shouldn't be there and are not necessary, and it works.
So I would like to know how is this really done, because I feel like I'm making no improvements. After reading post after post and blog after blog about I simply needed to transpile .ts files to .js, and simply put that javascript files on "some" folder the server uses, it would work. Not only it doesn't but when I use the original .ts files it does.
What might be going on and more important, how is this deployment (I guess it's called something else since I can't find much anything) properly done?
Make sure your .js file paths in your index.html page are correct. When you generate .js files in a folder(like build), your index.html may keep source paths for those .js files are like src="inline.js". So when you access index.html in build folder - localhost/build, it looks for those .js files in localhost only not localhost/build. Try to update source path of those .js files to /build/.
src="/build/inline.js".
you can do that using proxy option in Browser Sync..
proxy option link
I didn't try it but may be it will help you.

Visual Studio javaScript default directory with NuGet

I need some help with organizing js files in VS.
So my problem is, that VS(MVC) put all js files by default into the script directory, but i also have js created by me, in a sub directory, like this:
Now my problem is that when i open the scripts folder, the js files installed by NuGet take 2-3 screens in length, so i either have to open/close it every time, or scroll trought like there is no tomorrow.
So my question is, is there any good solutions to it? Like moving all the files into a subdirectory, and change every bundles, and NuGet config, or should i create a separate script directory for my custom js files? Any good ideas?
You can place and use as many subdirectories you wish for your own scripts.
With the help of Bundle.IncludeDirectory all your scripts will be added to the bundle without having to define multiple bundles.
Concerning nuget I don't think you can (re)place those scripts at a location of your choice.
See Stackoverflow: Include all files in a folder in a single bundle
Sadly you cannot change the default folder that NuGet downloads the files. Is the author of the NuGet package that decides where it will get installed.
An alternative is to use Bower. With it you can control where files get downloaded (look at this question).
Or, as you said, move your own javascripts to another folder and forget about the default.

Problems with public directory when deploying Node.js app with Heroku

I've been working on an app which will feature a Timelinejs (open source js library) element on the client side. I copied the Timelinejs library into my public/javascripts/ directory of my app. Then I linked it in my html header. When I serve my app up locally everything works fine with the timeline. However, I noticed that when I deployed my app to Heroku it wasn't loading my timeline. Using chrome js console I discovered that it didn't find my files in the public/Javascripts/Timelinejs folder. Using the Heroku run bash command I discovered that none of my Timelinejs files were present in the file structure, although an empty Timelinejs directory was present. Is there any command or configuration I need to specify to get these files to my Heroku deployment?
Heroku has a readonly file system. The directory where you can write are ./tmp or ./log. You can't write inside the public folder.
That's because of how they manage their dynos and the way to scale them. If you want to store something, use the ./tmp or, recommended, a s3 bucket. (as I presume 'tmp' stands for 'temporary' :D)
More info here: https://devcenter.heroku.com/articles/read-only-filesystem

How do I fix PhoneGap build errors?

I am trying to build a PhoneGap-based iPhone application, but I keep getting the following two errors:
./build-phonegap.sh: line 6: ./configure: No such file or directory
cp: lib/iphone/phonegap-min.js: No such file or directory
I built and installed the latest version of PhoneGap from the source on GitHub. I have checked to make sure that the PHONEGAPLIB variable is indeed set in XCode.
Where do I get the files listed? Where do I put them (to what are those paths relative)? And why aren't they already there?
Later
It seems the problem was that the project had been created with one version of PhoneGap (one that doesn't reference an external lib directory), but I was trying to run it with a newer one. Recreating the project with my latest version and copying over the www directory fixed the problem.
I am confused. What steps do I take? I just downloaded phonegap. I don't know how to "install" it. Do I have to run some git command or some build command before I can open it in xcode?
UPDATE:
Figured it out. I downloaded it. Unzipped it. Went into the phonegap folder. Duplicated the iphone folder. Opened xcode and hit build and go. It worked.
Apparently your iphone gap projects need to be a subfolder of the phonegap folder. That can probably be fixed/changed if you know what you're doing.
This video here helped me verify that all you need to do is download, unzip and open. The files inside your www do work by default.
http://www.youtube.com/watch?v=LcES5nIbMkk

Categories

Resources