I'm facing an issue while attempting to construct lumo (a Clojurescript REPL) from source within a Debian chroot environment. The error I encounter is as follows:
Building production bundle...
Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/cljs.js
Circular dependency: src/js/cli.js -> src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cli.js
Circular dependency: src/js/repl.js -> src/js/socketRepl.js -> src/js/repl.js
Circular dependency: src/js/cljs.js -> src/js/repl.js -> src/js/socketRepl.js -> src/js/cljs.js
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module 'rollup'
Require stack:
- /root/tmp/lumo-1.10.1/scripts/bundleForeign.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/root/tmp/lumo-1.10.1/scripts/bundleForeign.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/root/tmp/lumo-1.10.1/scripts/bundleForeign.js' ]
}
I've attempted yarn add rollup
, npm install rollup
, and npm install -g rollup
, with no success.
Regrettably, my understanding of this build system isn't sufficient to determine the next troubleshooting step.
Any suggestions?
Provided below are the build scripts: https://gist.github.com/cellularmitosis/df87e0c962e184b8bd29c8a3f07f3db4
EDIT: Here is what's in bundleForeign.js:
const rollup = require('rollup').rollup;
const resolve = require('rollup-plugin-node-resolve');
const replace = require('rollup-plugin-replace');
const commonjs = require('rollup-plugin-commonjs');
rollup({
input: 'node_modules/google-closure-compiler-js/compile.js',
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
resolve({
mainFields: ['module', 'main', 'jsnext:main'],
}),
commonjs(),
],
})
.then(bundle => {
bundle.write({
format: 'cjs',
file: 'target/google-closure-compiler-js.js',
strict: false,
});
})
.catch(console.error);
EDIT2: Is this potentially just a node problem?
I went ahead and created /tmp/foo.js:
const rollup = require('rollup').rollup;
Then executed cd /tmp && node foo.js
, resulting in the same error:
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module 'rollup'
Require stack:
- /tmp/foo.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/tmp/foo.js:1:16)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/tmp/foo.js' ]
}
I also tried npm install -g rollup
but that didn't make a difference. Perhaps node isn't searching for global modules correctly?