1
votes

I am trying to install an Elm-d3 connector I found on Github.

  • Elm is a functional-reactive programming language Evan Czaplicki
  • d3.js is the popular graphics meta-library by Michael Bostock

Elm-d3 enables you create type-safe, composable widgets using HTML, SVG, and CSS. D3 acts as a conceptual basis for the library, as well as an alternative renderer for Elm.


The first two install instructions are:

npm install smash
make

Installing smash goes smoothly (although I have to use sudo)

npm http GET https://registry.npmjs.org/smash
npm http 304 https://registry.npmjs.org/smash
npm http GET https://registry.npmjs.org/queue-async
npm http GET https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/queue-async
npm http GET https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/wordwrap
[email protected] ../../../node_modules/smash
├── [email protected]
└── [email protected] ([email protected])

However after installing I can't seem to refer to smash, which merges Javascript files together into one.

$ smash
bash: smash: command not found

I don't think node.js is actually used anywhere, just organized by npm. Why can't I find smash after installing it?

When I try to run make I get related errors:

make: node_modules/.bin/smash: Command not found
make: Nothing to be done for `all'.
1
Can you confirm two things: that there is a symlink in node_modules/.bin/smash; and if it exists that the file that the symlink points to is executable by your user? - seliopou
@seliopou doing npm -g install smash I can find smash but make says make: node_modules/.bin/smash: Command not found and also elm --src-dir=src --make -o src/D3.elm. I am reading the Makefile it says a bunch of interesting things - john mangual
@seliopou I switched node_modules/.bin/smash to say just smash in the makefile and it ran. moving forward :) - john mangual
I think I know what happened to you before. If you npm install ... a module, and you don't have either A. a node_modules folder OR B. a package.json file in that directory, npm looks up your directory tree starting at the current directory and installs it in the first location that satisfies A or B. Try using npm init to create a package.json file, and then try the npm install smash make and see if that works. - jshanley

1 Answers

2
votes

If you want to use smash (or just about any other npm program) from your bash prompt you need to install it globally by using the -g flag.

npm install -g smash