[Enter steps to reproduce:]
Atom: 1.36.0 x64
Electron: 4.1.1
OS: "Manjaro Linux"
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
at /packages/atom-beautify/node_modules/prettier/index.js:40203:21
at createCommonjsModule (/packages/atom-beautify/node_modules/prettier/index.js:193:35)
at /packages/atom-beautify/node_modules/prettier/index.js:40010:18)
at /packages/atom-beautify/node_modules/prettier/index.js:42016:3)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .js] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:4:12)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:1:1)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:1:1)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/index.coffee:120:20
at arrayMap (/packages/markdown-preview-plus/node_modules/lodash/lodash.js:639:23)
at Function.map (/packages/markdown-preview-plus/node_modules/lodash/lodash.js:9556:14)
at /packages/atom-beautify/src/beautifiers/index.coffee:119:22)
at /packages/atom-beautify/src/beautify.coffee:10:14)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at Package.requireMainModule (/usr/lib/atom/src/package.js:776:27)
-0:07.4.0 application:add-project-folder (ol.tree-view-root.full-menu.list-tree.has-collapsable-children.focusable-panel)
atom-beautify 0.33.4
atom-cform 0.6.0
atom-clock 0.1.16
busy-signal 2.0.1
emmet 2.4.3
file-icons 2.1.31
intentions 1.1.5
language-babel 2.85.0
language-dotenv 1.2.0
language-jenkinsfile 0.1.1
language-pug 0.0.22
language-terraform 0.8.1
language-vue 0.24.0
linter 2.3.0
linter-eslint 8.5.4
linter-pug 2.0.4
linter-ui-default 1.7.1
markdown-preview-plus 3.8.1
minimap 4.29.9
nord-atom-syntax 0.9.1
nord-atom-ui 0.11.0
northem-dark-atom-syntax 2.1.0
northem-dark-atom-ui 2.1.0
sync-settings 0.8.6
terraform-fmt 0.3.0
todo-show 2.3.2
I can confirm the same issue is occurring for me on Manjaro.
Manjaro Linux (KDE)
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=18.0.4
I have the issue as well.
Manjaro Linux (Gnome)
[Enter steps to reproduce:]
Atom: 1.36.0 x64
Electron: 4.1.1
OS: "Manjaro Linux"
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
at /packages/atom-beautify/node_modules/prettier/index.js:40747:21
at createCommonjsModule (/packages/atom-beautify/node_modules/prettier/index.js:188:35)
at /packages/atom-beautify/node_modules/prettier/index.js:40554:18)
at /packages/atom-beautify/node_modules/prettier/index.js:42567:3)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .js] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:4:12)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:1:1)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:1:1)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/index.coffee:120:20
at arrayMap (/packages/atom-beautify/node_modules/lodash/lodash.js:639:23)
at Function.map (/packages/atom-beautify/node_modules/lodash/lodash.js:9556:14)
at /packages/atom-beautify/src/beautifiers/index.coffee:119:22)
at /packages/atom-beautify/src/beautify.coffee:10:14)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at Package.requireMainModule (/usr/lib/atom/src/package.js:776:27)
atom-beautify 0.33.4
atom-material-syntax 1.0.8
atom-material-ui 2.1.3
cssbeautify 1.3.0
Same thing for me on Arch Linux. I've got the same stack trace output, etc., so I'll skip pasting it here, so the issue doesn't get too long with almost identical pastes. ;)
This seems to be a problem with one of the dependencies: prettier and not atom-beautify itself. It does a very strange eval() call, which seems to be redundant and from what I understand from the upstream issue, it's generated by a parser that's used to build the project.
Upstream issue: https://github.com/prettier/prettier/issues/6053
Fire up the ~/.atom/packages/atom-beautify/node_modules/prettier/index.js file (possible line numbers: 33160, 40204 or 40747 - as stated in the comments below) and change:
var utilInspect = eval("require('util').inspect");
to
var utilInspect = require('util').inspect;
After restarting the stack trace will go away and atom-beautify will function normally until an update is available. :smile:
@TeHMoroS For me it was in line 40747 :)
for me was the line 40204
[Enter steps to reproduce:]
Atom: 1.36.0 x64
Electron: 4.1.1
OS: "Manjaro Linux"
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
at /packages/atom-beautify/node_modules/prettier/index.js:40747:21
at createCommonjsModule (/packages/atom-beautify/node_modules/prettier/index.js:188:35)
at /packages/atom-beautify/node_modules/prettier/index.js:40554:18)
at /packages/atom-beautify/node_modules/prettier/index.js:42567:3)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .js] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:4:12)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:1:1)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:1:1)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/index.coffee:120:20
at arrayMap (/packages/atom-beautify/node_modules/lodash/lodash.js:639:23)
at Function.map (/packages/atom-beautify/node_modules/lodash/lodash.js:9556:14)
at /packages/atom-beautify/src/beautifiers/index.coffee:119:22)
at /packages/atom-beautify/src/beautify.coffee:10:14)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at Package.requireMainModule (/usr/lib/atom/src/package.js:776:27)
-0:12.7.0 application:open-file (a.btn-issue.btn.btn-error)
atom-beautify 0.33.4
atom-ide-terminal 5.0.1
Same here. @TeHMoroS workaround totally worked! The line number was 39937 for me.
There is comment in ~/.atom/packages/atom-beautify/node_modules/prettier/index.js says:
// plugin will look for `eval("require")()` and transform to `require()` in the bundle,
// and rewrite the paths to require from the top-level.
// We need to list the parsers and getters so we can load them only when necessary.
:thinking:
Sorry forgot to reply. The edit fixed my problem. I was 40747.
Thanks!!
@TeHMoroS workaround worked for me too! Thanks!
The line number was 40635 :)
Same issue happening for me on Arch Linux
@TeHMoroS 's fix worked for me as well, line 40747
@TeHMoroS could it be because of not having installed the formatter
Help me!
[Enter steps to reproduce:]
Atom: 1.36.1 x64
Electron: 4.1.4
OS: "Manjaro Linux"
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".
at /packages/atom-beautify/node_modules/prettier/index.js:40756:21
at createCommonjsModule (/packages/atom-beautify/node_modules/prettier/index.js:188:35)
at /packages/atom-beautify/node_modules/prettier/index.js:40563:18)
at /packages/atom-beautify/node_modules/prettier/index.js:42576:3)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .js] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:9:14)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:77:4)
at /packages/atom-beautify/src/beautifiers/prettier.coffee:81:3)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at /packages/atom-beautify/src/beautifiers/index.coffee:97:22
at arrayMap (/packages/atom-beautify/node_modules/lodash/lodash.js:639:23)
at Function.map (/packages/atom-beautify/node_modules/lodash/lodash.js:9556:14)
at /packages/atom-beautify/src/beautifiers/index.coffee:95:28)
at /packages/atom-beautify/src/beautify.coffee:15:16)
at /packages/atom-beautify/src/beautify.coffee:587:4)
at /packages/atom-beautify/src/beautify.coffee:591:3)
at Module._compile (/usr/lib/atom/src/native-compile-cache.js:87:30)
at Object.value [as .coffee] (/usr/lib/atom/src/compile-cache.js:235:23)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (internal/modules/cjs/loader.js:640:17)
at require (/usr/lib/atom/src/native-compile-cache.js:47:27)
at Package.requireMainModule (/usr/lib/atom/src/package.js:776:27)
at Package.activateNow (/usr/lib/atom/src/package.js:214:34)
at activationHookSubscriptions.add.packageManager.onDidTriggerActivationHook (/usr/lib/atom/src/package.js:895:75)
at Function.simpleDispatch (/usr/lib/atom/node_modules/event-kit/dist/emitter.js:64:14)
at Emitter.emit (/usr/lib/atom/node_modules/event-kit/dist/emitter.js:257:28)
at triggeredActivationHooks.forEach.hook (/usr/lib/atom/src/package-manager.js:712:80)
at Set.forEach (<anonymous>:null:null)
at PackageManager.activatePackage (/usr/lib/atom/src/package-manager.js:712:37)
at /usr/lib/atom/node_modules/settings-view/lib/package-manager.js:477:29
at exit (/usr/lib/atom/node_modules/settings-view/lib/package-manager.js:114:16)
at triggerExitCallback (/usr/lib/atom/src/buffered-process.js:258:9)
at bufferStream (/usr/lib/atom/src/buffered-process.js:279:9)
at Socket.stream.on (/usr/lib/atom/src/buffered-process.js:155:7)
at Socket.emit (events.js:187:15)
at Pipe._handle.close (net.js:606:12)
2x -8:30.3.0 incompatible-packages:view (div.incompatible-packages-status.inline-block.text.text-error)
atom-beautify 0.33.4
atom-ide-ui 0.13.0
ide-php 0.7.18
@marcelloinfoweb
check this workaround
This seems to be a problem with one of the dependencies: prettier and not atom-beautify itself. It does a very strange eval() call, which seems to be redundant and from what I understand from the upstream issue, it's generated by a parser that's used to build the project.
Upstream issue: prettier/prettier#6053
Workaround
Fire up the ~/.atom/packages/atom-beautify/node_modules/prettier/index.js file (possible line numbers: 33160, 40204 or 40747 - as stated in the comments below) and change:
var utilInspect = eval("require('util').inspect");
to
var utilInspect = require('util').inspect;After restarting the stack trace will go away and atom-beautify will function normally until an update is available.
It's already this way.

Are you changing the file at ~/.atom/packages/atom-beautify/node_modules/prettier/index.js? By looking at your stack trace it seems that that it's unchanged.
Yes, when I opened the file, it was this way, I did not make any changes.
I removed the extension, rebooted Atom and reinstalled, now it seems to be working fine.
If you come back to give the mistake, I'll come back here with the problem, okay?
Thanks for listening!
[Enter steps to reproduce:]
Atom: 1.40.1 x64
Electron: 3.1.10
OS: Microsoft Windows 10 Home
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Cannot find module './compile'
Error: Cannot find module './compile'
at Module._resolveFilename (internal/modules/cjs/loader.js:602:15)
at Module._resolveFilename (~/AppData/Local/atom/app-1.40.1/resources/electron.asar/common/reset-search-paths.js:35:12)
at Function.get_Module._resolveFilename (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:155413)
at Module.require (/app.asar/static/index.js:61:43)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/node_modules/har-validator/node_modules/ajv/lib/ajv.js:3:21)
at /packages/atom-beautify/node_modules/har-validator/node_modules/ajv/lib/ajv.js:499:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/node_modules/har-validator/lib/promise.js:1:166)
at /packages/atom-beautify/node_modules/har-validator/lib/promise.js:104:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/node_modules/request/lib/har.js:5:16)
at /packages/atom-beautify/node_modules/request/lib/har.js:207:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:559:12)
at Function.Module._load (internal/modules/cjs/loader.js:551:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/node_modules/request/request.js:23:11)
at /packages/atom-beautify/node_modules/request/request.js:1553:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.40.1/resources/app/static/<embedded>:11:150977)
atom-beautify 0.33.4
atom-clock 0.1.17
Hydrogen 2.10.3
local-history 4.3.1
I tried finding the line index.js in the prettier folder and this is what I got: http://prntscr.com/p4q6aa
[Enter steps to reproduce:]
Atom: 1.41.0 x64
Electron: 4.2.7
OS: Microsoft Windows 10 Pro
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Invalid or unexpected token
C:\Users\fish\.atom\packages\atom-beautify\src\beautify.coffee:1
(function (exports, require, module, __filename, __dirname, process, global, Buffer) { return function (exports, require, module, __filename, __dirname) {
SyntaxError: Invalid or unexpected token
at new Script (vm.js:79:7)
at NativeCompileCache.runInThisContext (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:146322)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:147206)
at Object.value [as .coffee] (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (internal/modules/cjs/helpers.js:20:18)
at customRequire (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:1:727373)
at Package.requireMainModule (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:3325206)
at Package.activateNow (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:3313190)
at string.e.trim.length.activationHookSubscriptions.add.packageManager.onDidTriggerActivationHook (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:14:2607)
at Function.simpleDispatch (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1211909)
at Emitter.emit (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:1213350)
at PackageManager.triggerDeferredActivationHooks (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:382998)
at activatePromise.Promise.all.then (~/AppData/Local/atom/app-1.41.0/resources/app/static/<embedded>:11:381749)
atom-beautify 0.33.4
atom-ide-ui 0.13.0
emmet 2.4.3
file-icons 2.1.36
git-blame 1.8.0
highlight-selected 0.16.0
ide-yaml 0.5.1
linter 2.3.1
linter-shellcheck 1.6.0
minimap 4.29.9
teletype 0.13.4
Tried uninstall, reinstalling multiple times, restarting Atom, installing from gui or apm.
Did anyone get a solution? I have the same error
[Enter steps to reproduce:]
Atom: 1.46.0 x64
Electron: 4.2.7
OS: Microsoft Windows 10 Pro
Thrown From: atom-beautify package 0.33.4
Failed to activate the atom-beautify package
At Invalid or unexpected token
C:\Users\Kerko\.atom\packages\atom-beautify\node_modules\bluebird\js\release\promise.js:1
(function (exports, require, module, __filename, __dirname, process, global, Buffer) { return function (exports, require, module, __filename, __dirname) {
SyntaxError: Invalid or unexpected token
at new Script (vm.js:79:7)
at NativeCompileCache.runInThisContext (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:146322)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:147206)
at Object.value [as .js] (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/node_modules/bluebird/js/release/bluebird.js:9:16)
at /packages/atom-beautify/node_modules/bluebird/js/release/bluebird.js:13:3)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:147429)
at Object.value [as .js] (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/src/beautifiers/index.coffee:3:11)
at /packages/atom-beautify/src/beautifiers/index.coffee:1:1)
at /packages/atom-beautify/src/beautifiers/index.coffee:1:1)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:147429)
at Object.value [as .coffee] (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:146745)
at /packages/atom-beautify/src/beautify.coffee:9:15)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at /packages/atom-beautify/src/beautify.coffee:2:1)
at Module.get_Module._compile (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:147429)
at Object.value [as .coffee] (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:150977)
at Module.load (internal/modules/cjs/loader.js:602:32)
at tryModuleLoad (internal/modules/cjs/loader.js:541:12)
at Function.Module._load (internal/modules/cjs/loader.js:533:3)
at Module.require (/app.asar/static/index.js:72:46)
at require (internal/modules/cjs/helpers.js:20:18)
at customRequire (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:1:721712)
at Package.requireMainModule (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:3299000)
at Package.activateNow (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:3286984)
at string.e.trim.length.activationHookSubscriptions.add.packageManager.onDidTriggerActivationHook (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:14:2607)
at Function.simpleDispatch (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:1215907)
at Emitter.emit (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:1217348)
at PackageManager.triggerDeferredActivationHooks (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:383144)
at activatePromise.Promise.all.then (~/AppData/Local/atom/app-1.46.0/resources/app/static/<embedded>:11:381895)
-6:57.2.0 application:open-file (input.hidden-input)
atom-beautify 0.33.4
atom-html-preview 0.2.6
atom-ternjs 0.20.0
autoclose-html 0.23.0
csslint 1.2.0
emmet 2.4.3
language-ejs 0.4.0
linter 2.3.1
linter-eslint 8.5.5
pigments 0.40.2
Sublime-Style-Column-Selection 1.7.5
OS: Microsoft Windows 10 Enterprise
Thrown From: atom-beautify package 0.33.4
Stack Trace
Failed to activate the atom-beautify package
Has Anyone find a Solution ?
Cannot find module './winston/transports'
Require stack:
Same Issue I uninstalled.
Most helpful comment
This seems to be a problem with one of the dependencies: prettier and not atom-beautify itself. It does a very strange eval() call, which seems to be redundant and from what I understand from the upstream issue, it's generated by a parser that's used to build the project.
Upstream issue: https://github.com/prettier/prettier/issues/6053
Workaround
Fire up the ~/.atom/packages/atom-beautify/node_modules/prettier/index.js file (possible line numbers: 33160, 40204 or 40747 - as stated in the comments below) and change:
var utilInspect = eval("require('util').inspect");to
var utilInspect = require('util').inspect;After restarting the stack trace will go away and atom-beautify will function normally until an update is available. :smile: