1

Does the embark framework use browserify for package management? How do I add a package (say buffer) to the project?

I used npm i --save-dev buffer and can see the dependency added to package.json and the node_modules folder but cannot var Buffer = require("Buffer") it. The var Buffer = require('buffer/').Buffer suggested by the docs doesn't work either.

The error in the javascript console in the browser is Error: Cannot find module 'Buffer' and Error: Cannot find module 'buffer/' respectively.

  • Not really an Ethereum question. You need to translate the code for the browser. Try browserify. – dbryson Mar 29 '16 at 11:06
  • The question is regarding adding the package to a specific Ethereum framework, namely Embark. – samurai jack Mar 29 '16 at 11:07
1

This is really a general node.js question, not isolated to Embark.

After you've written your code using node.js modules, you must translate it for browser use via Browserify.

  • Embark has browserify built-in. That means that I don't have to browserify the code as it is part of the workflow. Furthermore "embark build" (a complete rebuild) does not help. – samurai jack Mar 29 '16 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.