I'm getting this error and cannot find any way to fix it. It occurs upon trying to execute broccoli build
.
Error: Cannot find module 'broccoli' from '/Users/devel/Projects/broccoliTest'
at Function.module.exports [as sync] (/usr/local/lib/node_modules/broccoli-cli/node_modules/resolve/lib/sync.js:32:11)
at Object.<anonymous> (/usr/local/lib/node_modules/broccoli-cli/bin/broccoli:7:28)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
I've just installed sudo npm install -g broccoli
and sudo npm install -g broccoli-cli
. The broccoli
executable file is fine, obv:
>which broccoli
/usr/local/bin/broccoli
so it seems that the broccoli module is not correctly installed, although no error occured in the installation process.
ls /usr/local/lib/node_modules/broccoli
CHANGELOG.md LICENSE README.md docs lib node_modules package.json templates
Any ideas?
Globally installed packages aren't made available to require()
, by design:
- Install it locally if you're going to
require()
it.- Install it globally if you're going to run it on the command line.
- If you need both, then install it in both places, or use
npm link
.
You'll have to also install it locally, relative to your scripts:
cd /Users/devel/Projects/broccoliTest
npm install broccoli