The problem
I was using Atom Editor 1.14.4 with atom-beautify 0.29.17 package. When I tried to beautify a README.md file created with ansible-galaxy init <rolename> I got the following exception:
File 0Project 0No IssuesREADME.md9:77
LFUTF-8GitHub Markdowngit+
Cannot find module '../lib/language-code-rewrites'
Cannot find module '../lib/language-code-rewrites'
Hide Stack Trace
Error: Cannot find module '../lib/language-code-rewrites'
at Module._resolveFilename (module.js:455:15)
at Module._resolveFilename (/usr/share/atom/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.Module._resolveFilename (/usr/share/atom/resources/app.asar/src/module-cache.js:383:52)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:50:27)
at Object.<anonymous> (/home/ane058/.atom/packages/atom-beautify/node_modules/tidy-markdown/lib/converters.js:12:23)
at Module._compile (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:109:30)
at Object.value [as .js] (/usr/share/atom/resources/app.asar/src/compile-cache.js:216:21)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:50:27)
at Object.<anonymous> (/home/ane058/.atom/packages/atom-beautify/node_modules/tidy-markdown/lib/index.js:16:14)
at Module._compile (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:109:30)
at Object.value [as .js] (/usr/share/atom/resources/app.asar/src/compile-cache.js:216:21)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (/usr/share/atom/resources/app.asar/src/native-compile-cache.js:50:27)
at /home/ane058/.atom/packages/atom-beautify/src/beautifiers/tidy-markdown.coffee:13:22
at Promise._execute (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:79:10)
at TidyMarkdown.module.exports.TidyMarkdown.beautify (/home/ane058/.atom/packages/atom-beautify/src/beautifiers/tidy-markdown.coffee:12:16)
at /home/ane058/.atom/packages/atom-beautify/src/beautifiers/index.coffee:318:24
at Promise._execute (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/debuggability.js:300:9)
at Promise._resolveFromExecutor (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:79:10)
at /home/ane058/.atom/packages/atom-beautify/src/beautifiers/index.coffee:240:18
at tryCatcher (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:638:18)
at PromiseArray._resolve (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise_array.js:126:19)
at PromiseArray._promiseFulfilled (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise_array.js:144:14)
at Promise._settlePromise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:574:26)
at Promise._settlePromise0 (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._resolveCallback (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:432:57)
at Promise._settlePromiseFromHandler (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:524:17)
at Promise._settlePromise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._resolveCallback (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:432:57)
at Promise._settlePromiseFromHandler (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:524:17)
at Promise._settlePromise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._resolveCallback (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:432:57)
at ReductionPromiseArray._resolve (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/reduce.js:61:19)
at Promise.completed [as _fulfillmentHandler0] (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/reduce.js:122:15)
at Promise._settlePromise (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:566:21)
at Promise._settlePromise0 (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:693:18)
at Async._drainQueue (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:143:10)
at Async.drainQueues (/home/ane058/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:17:14)
I logged it as an issue at https://github.com/Glavin001/atom-beautify/issues/1549, but after a few days of tinkering I finally found the likely root cause, and working solution.
The investigation
The exception suggest there is an issue with the tidy-markdown dependency, and it turned out that tidy-markdown 2.0.5 npm package had been released a few days earlier at https://www.npmjs.com/package/tidy-markdown
ls ~/.atom/.apm/tidy-markdown/
showed that atom-beautify had pulled down the tidy-markdown 2.0.5 package.
The solution
cd ~/.atom/packages/atom-beautify
npm install tidy-markdown@2.0.4
No comments:
Post a Comment