Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems installing the dependencies #648

Closed
brianbancroft opened this issue Sep 28, 2015 · 8 comments
Closed

Problems installing the dependencies #648

brianbancroft opened this issue Sep 28, 2015 · 8 comments

Comments

@brianbancroft
Copy link
Contributor

Hi there,

I'm having a bit of trouble in making it to the starting gate to make it to the issue offered for first-timers: #647

Specifically, I wasn't able to load the sample html file locally. Instead, I got what appears to be the leaflet framework, but with no basemap. I believe the problem is related to my inability to install the dependencies properly using "npm install". I've installed what appears to be the latest nodejs using sudo apt-get install, and have attempted to install esri-leaflet using the directions found on the readme.md.

At somepoint in the npm install process, I run into a lot of red. This is where it starts going bad:

npm ERR! Error: ENOENT, lstat '/home/brian/Mytest/esri-leaflet/node_modules/grunt-sass/node_modules/node-sass/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/.npmignore'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

I'm unsure where to go next. I'd love to help with the problem, but I got to make it to the starting line first. I'm running on a Thinkpad t430 with a newly-installed copy of Ubuntu 14.04.

Thanks for any assistance!

screenshot from 2015-09-28 18 16 25

@jgravois
Copy link
Contributor

hi @brianbancroft. thanks so much for jumping in to contribute to this project!

based on my reading of your error logs, i'm under the impression that something is wrong with your base installation of node/npm. when you type the following commands into the terminal, what is returned?

$ node --version
v4.1.1
$ npm --version
2.14.4

secondly, its always a good idea to use http:// protocol when you load local web applications. check out this gist for more information about serving up local files via http:// for more information.

@brianbancroft
Copy link
Contributor Author

Hi @jgravois,

Based on your suggestion, I looked at what I had, but couldn't get the version out of node or npm. So I uninstalled using the package manager, and reinstalled using apt-get install. Here's what I have now:

brian@brian-ThinkPad-T430:~$ npm --version
1.3.10
brian@brian-ThinkPad-T430:~$ nodejs --version
v0.10.25

Thanks for pointing me in this direction. This is certainly one problem down. There's still another to go, unfortunately:

brian@brian-ThinkPad-T430:~/Mytest/esri-leaflet$ sudo npm run build

> esri-leaflet@2.0.0-beta.6 prebuild /home/brian/Mytest/esri-leaflet
> mkdirp dist

/usr/bin/env: node: No such file or directory
npm ERR! weird error 127
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! not ok code 0

On a side note, I'm currently attempting to get the http-server as illustrated in your gist to work, but I'm running into similar problems as here.

@jgravois
Copy link
Contributor

since you noted that in terminal, nodejs is what's actually on your $PATH, perhaps you just need to follow @othiym23's advice in nodejs/node-v0.x-archive#3911 and use a different distro, or perhaps symlink to node as digitalmediums suggests.

(i'm not a linux user, so please take this recommendation with a grain of salt)

@GISDev01
Copy link

@brianbancroft Since you're on ubuntu:
sudo apt-get install nodejs-legacy
should do the trick to fix that error.
Then running npm install shouldn't be throwing a bunch of red errors anymore.

For the http-server stuff, this should do the trick:
sudo npm install http-server -g
Then, in your esri-leaflet directory (your cloned repo), run this (changing the directory to where yours if located if you didn't clone it into your home directory):
sudo http-server ~/esri-leaflet/ -p 80
Then in your browser, if you hit up:
http://localhost/debug/sample.html
If all goes according to plan, you should get a basemap and some blue states

@brianbancroft
Copy link
Contributor Author

Thanks @GISDev01 ! This has solved my shenanigans 👍

@jgravois jgravois closed this as completed Oct 1, 2015
@brianbancroft
Copy link
Contributor Author

Sorry to say, but I do still have some troubles getting this to work via http-server.

The file runs locally off of file:///.../debug.html with blue states, but when I try to run this via http-server in the way prescribed by @GISDev01, I get the blank window with the title div. When I inspect the terminal window that is running http-server, I run into the following problem:

[Wed, 07 Oct 2015 02:26:30 GMT] "GET /node_modules/leaflet/dist/leaflet.css" Error (404): "Not found"
[Wed, 07 Oct 2015 02:26:30 GMT] "GET /node_modules/leaflet/dist/leaflet.js" Error (404): "Not found"
[Wed, 07 Oct 2015 02:26:30 GMT] "GET /dist/esri-leaflet.js" Error (404): "Not found"
[Wed, 07 Oct 2015 02:26:30 GMT] "GET /favicon.ico" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36"
[Wed, 07 Oct 2015 02:26:30 GMT] "GET /favicon.ico" Error (404): "Not found"

@jgravois
Copy link
Contributor

jgravois commented Oct 7, 2015

are you sure that you've cded into the appropriate folder? (ie: can you load a generic hello world.html file in the root of the web server which has been spun up?)

if so, are you positive that the resources which can't be loaded are present in the locations http-server is checking?

@brianbancroft
Copy link
Contributor Author

So I started with the hello world the other day. a simple index.html and it worked fine.

But it turns out that the problem was the directory that I referenced. By choosing /home/brian/git/esri-leaflet/debug/ as the directory in http-server, it meant that I wasn't able to access the files in any prior directory such as .../esri-leaflet/. I realized this just now and tested by trying to reference a text file with a few words that I threw in the /esri-leaflet/ directory. It didn't work, but choosing the /home/brian/git/esri-leaflet/ as my directory in http-server did, and allowed me to test the webpage the proper way.

There was so much learnt in this frustrating exercise. From beginner-level applied practice in command line, to the more important lesson you were trying to impart: For debugging, and testing recent changes, serving the webpage through a server protocol as opposed to through file protocol is much less hassle, once you get things running.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants