jbrooksuk / node-summary

Node module that summarizes text using a naive summarization algorithm
http://jbrooksuk.github.io/node-summary/
769 stars 93 forks source link

SyntaxError: Unexpected identifier #42

Open sheksushant opened 6 years ago

sheksushant commented 6 years ago

/Users/sushant/Desktop/summarize/nodemodules/node-summary/lib/summary.js:1 (function (exports, require, module, filename, dirname) { import from 'lodash' ^

SyntaxError: Unexpected identifier

fix for this?

emhagman commented 6 years ago

+1

AlexandruSimandi commented 6 years ago

+1

goalia commented 5 years ago

+1

guy16510 commented 5 years ago

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

corysimmons commented 5 years ago

@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.

503Dev commented 5 years ago

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

bonesoul commented 5 years ago

can we get a fixed release on npm pls?

hanxue commented 5 years ago

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
nitish24p commented 4 years ago

Can this fix plz plz be pushed to npm

sheksushant commented 4 years ago

@jbrooksuk ?