Update error: Cannot babelify - Unknown plugin "transform-object-rest-spread"

After the latest update (ERPNext v10.0.23/Frappe v10.0.25), I am experiencing a dependency issue. Running

$ bench update

works, but raises several errors like this:

Cannot babelify /home/frappe/frappe-bench/apps/erpnext/erpnext/stock/dashboard/item_dashboard.js
ReferenceError: Unknown plugin "transform-object-rest-spread" specified in "base" at 0, attempted to resolve relative to "/home/frappe/frappe-bench/sites"
    at /home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (/home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/home/frappe/frappe-bench/apps/frappe/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at babelify (/home/frappe/frappe-bench/apps/frappe/frappe/build.js:161:16)
    at get_compiled_file (/home/frappe/frappe-bench/apps/frappe/frappe/build.js:148:18)

I cannot seem to find the dependency Unknown plugin “transform-object-rest-spread”, anyone has any clue?

Hi, sorry but have you tried to run bench update again? and other commands like
bench build. And it looks as github issue

This may shed some light?

frappe@erpnext:~/frappe-bench$ npm list | grep babel

Hi @NMyshuk and @clarkej,

thanks for your feedback.

Other than building, the installation works well. All commands such as bench update, bench update --requirements, bench migrate, bench restart work fine without any warnings or the like. Only bench build fails with the above error and the output in sites/assets/js/ is throwing various errors. I can work around this by replacing the sites/assets/js with working files from another server and thereby getting the system to work normally, but that obviously only works as long as the system does not rebuild and overwrites the files.

NodeJS seems to be ok (apt list --installed nodejs): nodejs/unknown,now 6.13.0-1nodesource1 amd64 [installed]

Running npm list | grep babel returns babel@6.23.0 which should be ok… Yet, there is a note when running npm install babel, saying babel@6.23.0: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers Installing npm install babel-cli works, but bench build still throws ReferenceError: Unknown plugin “transform-object-rest-spread”

Thanks for pointing me in the right direction, got it now :wink:

On the error

ReferenceError: Unknown plugin “transform-object-rest-spread”

I had to install the dependency

sudo npm install babel-plugin-transform-object-rest-spread

After that, the following error occurred on bench build:

Error: Couldn't find preset "env" relative to directory "/home/frappe/frappe-bench/sites"

This was resolved with

sudo npm install babel-preset-env

And now it works :wink: Not sure what put the system into this state (vanilla Debian 8 with easy install script production). Again, thanks.

8 Likes

Has anyone opened an issue on Github yet? I just hit the same issue on a clean Ubuntu 16.04 install + install script.

Installing the extra npm packages and running bench update again fixed it for me as well.

GitHub issue created:

https://github.com/frappe/bench/issues/576

1 Like