Closed wjandrea closed 2 years ago
I just found #116 → atom/atom/issues/23224, and it looks like this is a broader issue. Any workaround then?
I just noticed, the package is actually working fine despite the error. Hmm...
It must be this package that's causing the problem:
https://github.com/ioquatix/shell-environment/blob/master/lib/index.js#L4
Can you try deleting the package from .atom/packages/script-runner
and try reinstalling?
I deleted the folder .atom/packages/script-runner
then ran apm install script-runner
, but the error persists.
While I was testing, I tried apm install 'script-runner@2.6.0'
, and the error persists, and the package still works fine. Very strange...
Ultimately, if there is an issue, it's with os-locale
which we should try to pin to a version that works with commonjs.
I just noticed, the package is actually working fine despite the error. Hmm...
Whoops! I just realized I was confusing this package with run-in-terminal
! In fact, script-runner
doesn't work.
Sorry, I'm just going to use run-in-terminal
instead. It's more powerful though it has some rough edges (no working defaults and invalid quoting when passing args to scripts, IIRC).
This should now be fixed but you will need to reinstall, a dependent package had a bad version pin.
There is one more package that has updated to use ES6 imports, the See ioquatix/shell-environment#5 fοr more detail.os-locale
dependency of shell-environment
.
Edit: I apparently should have read the whole thread, as you seem to have already identified that package. However, as far as I can tell, no fix appears to have been applied yet.
Atom doesn’t support ES module’s unfortunately so I’ve pinned all the dependencies to non-ES modules. I’ve tested this locally and it appears to be working on both Linux and macOS.
Ah, sorry, I didn't realize that you had updated shell-environment
's NPM module ahead of the repository. I just did a reinstall, and it seems to all work now.
I just updated and now when I open a new window, I get this error.
As well, the links in the error popup don't work, but I'm not sure if these are the fault of the package or Atom:
POST https://is.gd/create.php?format=simple 400
ssh://git@github.com/ioquatix/script-runner
More info
Here's the relevant info from the error report. I can add more if needed.
Versions
Atom: 1.60.0 x64 Electron: 9.4.4 OS: Ubuntu 20.04.4 Thrown From: script-runner package 2.6.1
Stack Trace
Failed to load the script-runner package ``` At Cannot use import statement outside a module /home/wja/.atom/packages/script-runner/node_modules/os-locale/index.js:1 (function (exports, require, module, __filename, __dirname, process, global, Buffer) { return function (exports, require, module, __filename, __dirname) { import lcid from 'lcid'; ^^^^^^ SyntaxError: Cannot use import statement outside a module at new Script (vm.js:84:7) at NativeCompileCache.runInThisContext (/usr/share/atom/resources/app/static/:11:148836)
at Module.get_Module._compile (/usr/share/atom/resources/app/static/:11:149690)
at Object.value [as .js] (/usr/share/atom/resources/app/static/:11:153507)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module._load (electron/js2c/asar.js:769:28)
at Module.require (/app.asar/static/index.js:72:46)
at require (/usr/share/atom/resources/app/static/:11:149229)
at /packages/script-runner/node_modules/shell-environment/lib/index.js:4:16)
at /packages/script-runner/node_modules/shell-environment/lib/index.js:122:34)
at Module.get_Module._compile (/usr/share/atom/resources/app/static/:11:149913)
at Object.value [as .js] (/usr/share/atom/resources/app/static/:11:153507)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module._load (electron/js2c/asar.js:769:28)
at Module.require (/app.asar/static/index.js:72:46)
at require (/usr/share/atom/resources/app/static/:11:149229)
at /packages/script-runner/lib/script-runner.js:7:26)
at /packages/script-runner/lib/script-runner.js:179:2)
at Module.get_Module._compile (/usr/share/atom/resources/app/static/:11:149913)
at Object.value [as .js] (/usr/share/atom/resources/app/static/:11:153507)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module._load (electron/js2c/asar.js:769:28)
at Module.require (/app.asar/static/index.js:72:46)
at require (internal/modules/cjs/helpers.js:74:18)
at customRequire (/usr/share/atom/resources/app/static/:1:756277)
at requireModule (/usr/share/atom/resources/app/static/:14:1175133)
at Package.requireMainModule (/usr/share/atom/resources/app/static/:11:3421427)
```
For reference, here's the GitHub comparison of 2.6.0 vs 2.6.1.
Issue #117 had the same error but no additional details