browserify error /usr/bin/env: node: No such file or directory

Some linux distributions install nodejs not as “node” executable but as “nodejs”. In this case you have to manually link to “node” as many packages are programmed after the “node” binary. Something similar also occurs with “python2” not linked to “python”. In this case you can do an easy symlink. For linux distributions which install … Read more

SyntaxError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’ – Gulp

Older versions of Babel came with everything out of the box. The newer version requires you install whichever plugins your setup needs. First, you’ll need to install the ES2015 preset. npm install babel-preset-es2015 –save-dev Next, you need to tell babelify to use the preset you installed. return browserify({ … }) .transform(babelify.configure({ presets: [“es2015”] })) … … Read more

Browserify, Babel 6, Gulp – Unexpected token on spread operator

That syntax is an experimental proposed syntax for the future, it is not part of es2015 or react so you’ll need to enable it. npm install –save-dev babel-plugin-transform-object-rest-spread and add “plugins”: [“transform-object-rest-spread”] into .babelrc alongside your existing presets. Alternatively: npm install –save-dev babel-preset-stage-3 and use stage-3 in your presets to enable all stage-3 experimental functionality.

How to import jquery using ES6 syntax?

index.js import {$,jQuery} from ‘jquery’; // export for others scripts to use window.$ = $; window.jQuery = jQuery; First, as @nem suggested in comment, the import should be done from node_modules/: Well, importing from dist/ doesn’t make sense since that is your distribution folder with production ready app. Building your app should take what’s inside … Read more