Atom-beautify: Error: Cannot find module '../lib/language-code-rewrites'

Created on 9 Mar 2017  路  6Comments  路  Source: Glavin001/atom-beautify

Description

Doing atom-beautify on a markdown file causes an exception. Full stack trace in the Comments section.

Input Before Beautification

This is what the code looked like before:

Role Name
=========

A brief description of the role goes here.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

    - hosts: servers
      roles:
         - { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).

Expected Output

The beautified code should have looked like this:

N/A, since atom-beautify failed with an exception it is hard to tell how it should look like.

Actual Output

N/A, since atom-beautify failed with an exception

Steps to Reproduce

  1. Add code to Atom editor
  2. Run command Atom Beautify: Beautify Editor
  3. Experience: Error: Cannot find module '../lib/language-code-rewrites'

Debug

Here is a link to the debug.md Gist: https://gist.github.com/avnes/7631d41839d3d2b21013823209590d85

Checklist

I have:

  • [yes ] Tried uninstalling and reinstalling Atom Beautify to ensure it installed properly
  • [ yes] Reloaded (or restarted) Atom to ensure it is not a caching issue
  • [yes ] Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
    so I know this is not a duplicate issue
  • [yes ] Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
  • [yes ] Generated debugging information by executing Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issue
bug published

Most helpful comment

I think I've found the root cause, and I have found a solution. that works until this is fixed.

Apparently there was a new 2.0.5 release of tidy-markdown about 1 week ago according to https://www.npmjs.com/package/tidy-markdown

So I tried a "downgrade":

cd ~/.atom/packages/atom-beautify
npm install [email protected]

Now I am able to beautify markdown with the tidy-beautifier :)

All 6 comments

Here is the full stack trace:

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)

+1

娌′汉淇浜嗗悧

I found a workaround that I can live with:

  1. Go into atom-beautify settings
  2. Choose Markdown
  3. Change Default Beautifier from 'Tidy Markdown' to 'Remark'

I think I've found the root cause, and I have found a solution. that works until this is fixed.

Apparently there was a new 2.0.5 release of tidy-markdown about 1 week ago according to https://www.npmjs.com/package/tidy-markdown

So I tried a "downgrade":

cd ~/.atom/packages/atom-beautify
npm install [email protected]

Now I am able to beautify markdown with the tidy-beautifier :)

Published to v0.29.19

Was this page helpful?
0 / 5 - 0 ratings