React-sketchapp: Doesn't work on El Capitan and lower

Created on 29 Nov 2017  Â·  18Comments  Â·  Source: airbnb/react-sketchapp

I m beginner, i tried to install but when I open the basic-setup plugin file, nothing is shown, just blank. (I see plugin is successfully installed on Sketch on Plugin tab)
| -------------------------------------------------------------------------------------------------
| Reporting a bug or issue
| ------------------------------------------------------------------------------------------------
After npm install

-> [email protected] install /Users/bhur/react-sketchapp/examples/basic-setup/node_modules/fsevents

node install

[fsevents] Success: "/Users/bhur/react-sketchapp/examples/basic-setup/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

[email protected] postinstall /Users/bhur/react-sketchapp/examples/basic-setup/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
node lib/post_install.js

[email protected] postinstall /Users/bhur/react-sketchapp/examples/basic-setup
npm run build && skpm-link

[email protected] build /Users/bhur/react-sketchapp/examples/basic-setup
skpm-build

[1/2] đź–¨ Copied src/manifest.json in 10ms
[2/2] âš’ Built ./my-command.js in 963ms
success Plugin built
[1/1] đź”— Symlinking the plugin basic-setup...
success Plugin basic-setup symlinked
basic-setup - 1.0.0

warning Starting with Sketch 45, you need to restart Sketch for your plugin to appear in the "plugins" menu

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No repository field.

After npm run render,

[email protected] render /Users/bhur/react-sketchapp/examples/basic-setup
skpm-build --watch --run

đź–¨ Copied src/manifest.json in 12ms
SyntaxError: Unexpected identifier 'j'. Expected either 'in' or 'of' in enumeration syntax..
Plugin “react-sketchapp: Basic Setup”, line 7314:
» for (let j = 0; j < object.count(); j += 1) {
⛏ Built ./my-command.js in 4627ms

Sketch version:
47

bug

Most helpful comment

I'm also getting an error

âžś  basic-setup git:(master) npm run render

> [email protected] render /Users/dwicao/Documents/sketch/react-sketchapp/examples/basic-setup
> skpm-build --watch --run

đź–¨  Copied src/manifest.json in 13ms
SyntaxError: Unexpected identifier 'original'.
Plugin “my-command”, line 26854:
»     let original = prototype[name];
🔩  Built ./my-command.js in 3011ms

node 8.9.1
npm 5.5.1
Sketch 48.2
OSX 10.11.6

Any workaround?

All 18 comments

What operating system are you on?

OS X El Capitan .Ver 10.11.6

+1

I'm having the same issue, it works fine on my mac with Sierra, but with my other mac that runs El Capitan it throws the same error.

SyntaxError: Unexpected identifier 'j'. Expected either 'in' or 'of' in enumeration syntax..
Plugin “yaardvark-core: Render”, line 7287:
»   for (let j = 0; j < object.count(); j += 1) {

+1 HighSierra
SketchApp 48.1

I'm getting

TypeError: MSAttributedString.alloc().initWithAttributedString is not a function. (In 'MSAttributedString.alloc().initWithAttributedString(attribStr)', 'MSAttributedString.alloc().initWithAttributedString' is undefined)
line: 2957

Running High Sierra 10.13.1, Sketch 48.1

Wait nevermind, this is a different issue. @saiqulhaq see https://github.com/airbnb/react-sketchapp/issues/213#issuecomment-350017757, it doesn't work with Sketch 48

@maartenschumacher ok thanks, I will try

it does work with Sketch48, see https://github.com/airbnb/react-sketchapp/issues/225

This is issue is about El Capitan and lower

Hi - getting the same issue - also on El Cap - any ETA on this?

I follow the instructions and get so far:

Copied src/manifest.json in 12ms
SyntaxError: Unexpected identifier 'j'. Expected either 'in' or 'of' in enumeration syntax..
Plugin “my-command”, line 8430:
» for (let j = 0; j < object.count(); j += 1) {
⛏ Built ./my-command.js in 2218ms

And then nothing.

node 9.3.0
npm 5.6.0
Sketch 48.1
OSX 10.11.6

I'm stumped.

I'm also getting an error

âžś  basic-setup git:(master) npm run render

> [email protected] render /Users/dwicao/Documents/sketch/react-sketchapp/examples/basic-setup
> skpm-build --watch --run

đź–¨  Copied src/manifest.json in 13ms
SyntaxError: Unexpected identifier 'original'.
Plugin “my-command”, line 26854:
»     let original = prototype[name];
🔩  Built ./my-command.js in 3011ms

node 8.9.1
npm 5.5.1
Sketch 48.2
OSX 10.11.6

Any workaround?

I'm getting this same error as well. Any updates ?
Sketch 49
OSX 10.11.6

workaround: update your macOS

Does that workaround post mean this is a wontfix?

I traced this to the [email protected] library, which uses let, which the version of WebKit that Sketch has on 10.11 doesn’t like.

A quick check seemed to show that yoga-layout 1.9 is correctly restricted to ES2015 ES5 and probably would prevent this from happening.

I’m also looking into whether it’s feasible to hack the webpack config to run Babel on the yoga-layout package.

_Edit:_ Mis-spoke and said "ES2015" when what I meant was "ES5".

Couldn’t we make a PR to that package and lower its language support? “Restricted to ES2015” isn’t what I’d call “correct”; the ecosystem convention in JS is ES5 CJS.

Sorry, I meant ES5. Updated my comment above.

FWIW I got this running locally by adding the following webpack.skpm.config.js file to my plugin’s root:

module.exports = function (config, isPluginCommand) {
  config.module.rules[0].exclude = /node_modules\/(?!(yoga-layout\/sources))/
  return config;
}

Note: This only works if yoga-layout was installed just inside node_modules, which is what npm will probably do, if you haven’t messed around and installed competing versions of it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jaridmargolin picture jaridmargolin  Â·  6Comments

LincMitch picture LincMitch  Â·  7Comments

tysoncadenhead picture tysoncadenhead  Â·  7Comments

yu-tou picture yu-tou  Â·  5Comments

ziggygou picture ziggygou  Â·  6Comments