ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Error: Cannot find module 'rollup'

update_problem
installation_problem

#1

Hi,
I’ve tried everything I can find about this error regarding yarn, .config and .npm access, bench update, bench migrate etc etc. and still I have the error. I’m guessing its fairly fundamental but nonetheless broken. I’m using Ubuntu server 14.04 and the 11.1.3 versions of erpnext. This is driving me nuts.

yarn run v1.14.0
$ FRAPPE_ENV=production node rollup/build.js
module.js:550
throw err;
^

Error: Cannot find module ‘rollup’
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/tony/frappe-bench/apps/frappe/rollup/build.js:4:16)
at Module._compile (module.js:653:30)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
frappe-bench-node-socketio: stopped
frappe-bench-frappe-web: stopped
frappe-bench-frappe-schedule: stopped
frappe-bench-frappe-default-worker-0: stopped
frappe-bench-frappe-long-worker-0: stopped
frappe-bench-frappe-short-worker-0: stopped
frappe-bench-frappe-web: started
frappe-bench-node-socketio: started
frappe-bench-frappe-schedule: started
frappe-bench-frappe-default-worker-0: started
frappe-bench-frappe-long-worker-0: started
frappe-bench-frappe-short-worker-0: started


#2

Finally some progress - note this i s at least partially hampered by the lack of a verbose mode. It seems that dependencies have to be installed in ~/
going back to home and installing the dependencies one at a time with npm cleared the errors:
cd /~
sudo npm install rollup-plugin-multi-entry
sudo npm install rollup-plugin-commonjs
sudo npm install rollup-plugin-node-resolve
sudo npm install rollup-plugin-node-resolve
sudo npm install rollup-plugin-postcss
sudo npm install rollup-plugin-buble
sudo npm -g install yarn
sudo npm install rollup-plugin-uglify
sudo npm install rollup-plugin-vue

and it goes on…


#3

and now a new error.
Bottom line is that the install seems to have put node in home but is looking for it in frappe-bench

yarn run v1.13.0
$ FRAPPE_ENV=production node rollup/build.js
Production mode
fs.js:646
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^

Error: ENOENT: no such file or directory, open ‘/home/tony/frappe-bench/apps/frappe/node_modules/moment/min/moment-with-locales.min.js’
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at input_files.map.file_name (/home/tony/frappe-bench/apps/frappe/rollup/build.js:90:39)
at Array.map ()
at files_to_concat.forEach.output_file (/home/tony/frappe-bench/apps/frappe/rollup/build.js:84:36)
at Array.forEach ()
at concatenate_files (/home/tony/frappe-bench/apps/frappe/rollup/build.js:81:18)
at Object. (/home/tony/frappe-bench/apps/frappe/rollup/build.js:24:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


#4

So I tried and tried and tried…
…then I succeeded. Seems like there is some kind of collision with the various nodejs package managers and where they put the files which is leading to a lot of confusion as modules exist in several locations.

I followed instructions from here:

Specifically:
sudo npm install -g yarn
cd to frappe folder (something like ./apps/frappe. It should contain a yarn.lock file
sudo yarn

cd ~/frappe-bench
sudo npm install -g yarn
bench update --requirements
bench setup socketio
bench build
bench update

and it finally worked.


#5