node-summary icon indicating copy to clipboard operation
node-summary copied to clipboard

SyntaxError: Unexpected identifier

Open sheksushant opened this issue 6 years ago • 10 comments

/Users/sushant/Desktop/summarize/node_modules/node-summary/lib/summary.js:1 (function (exports, require, module, __filename, __dirname) { import _ from 'lodash' ^

SyntaxError: Unexpected identifier

fix for this?

sheksushant avatar Sep 03 '18 20:09 sheksushant

+1

emhagman avatar Sep 24 '18 01:09 emhagman

+1

AlexandruSimandi avatar Oct 23 '18 05:10 AlexandruSimandi

+1

goalia avatar Dec 08 '18 20:12 goalia

It appears that if you update the summary.js file to use 'require' instead of 'import' it works fine.

guy16510 avatar Dec 19 '18 15:12 guy16510

@jbrooksuk Seems like the repo's /lib is out of sync with what's on npm.im/node-summary

Bump patch version in package.json then npm publish to fix maybe?

If not, @guy16510 's suggestion works.

corysimmons avatar Jan 15 '19 14:01 corysimmons

To expand on this for anyone still struggling, if you still can't make progress after @corysimmons suggestion then you need to navigate to your projects root folder then -> node_modules -> node-summary -> lib -> summary.js

Replace the first 3 lines with the following: var _ = require('lodash') var Tokenizer = require('sbd') var request = require('request')

Note: There are other ways to accomplish the same but in essence with the current stable Node release you would want to use require instead of import

503Dev avatar Apr 04 '19 20:04 503Dev

can we get a fixed release on npm pls?

bonesoul avatar Apr 08 '19 13:04 bonesoul

Hello @jbrooksuk , would you consider perhaps a minor 1.2.1 release? node-summary does not work when ES6 syntax is used,

const SummaryTool = require('node-summary')

project/node_modules/node-summary/lib/summary.js:1
(function (exports, require, module, __filename, __dirname) { import _ from 'lodash'
                                                                     ^

SyntaxError: Unexpected identifier

hanxue avatar May 09 '19 09:05 hanxue

Can this fix plz plz be pushed to npm

nitish24p avatar Nov 03 '20 19:11 nitish24p

@jbrooksuk ?

sheksushant avatar Nov 03 '20 19:11 sheksushant