octet-stream / form-data

Spec-compliant FormData implementation for Node.js
https://www.npmjs.com/package/formdata-node
MIT License
142 stars 17 forks source link

error: uncaughtException: Unexpected token * #17

Closed akshay27395 closed 4 years ago

akshay27395 commented 4 years ago

getting this error while running my node application.

error: uncaughtException: Unexpected token /node_modules/formdata-node/lib/FormData.js:206 async __getField() { ^

SyntaxError: Unexpected token at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:599:28) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (/node_modules/@tim-lai/isomorphic-form-data/lib/index.js:2:18) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (/node_modules/swagger-client/dist/index.js:320:18) at webpack_require (/node_modules/swagger-client/dist/index.js:21:30) at Module. (/node_modules/swagger-client/dist/index.js:536:29) at webpack_require (/node_modules/swagger-client/dist/index.js:21:30) at Object. (/node_modules/swagger-client/dist/index.js:404:18) {"error":{},"stack":"/node_modules/formdata-node/lib/FormData.js:206\n async getField() {\n ^\n\nSyntaxError: Unexpected token *\n at createScript (vm.js:80:10)\n at Object.runInThisContext (vm.js:139:10)\n at Module._compile (module.js:599:28)\n at Object.Module._extensions..js (module.js:646:10)\n at Module.load (module.js:554:32)\n at tryModuleLoad (module.js:497:12)\n at Function.Module._load (module.js:489:3)\n at Module.require (module.js:579:17)\n at require (internal/module.js:11:18)\n at Object. (/node_modules/@tim-lai/isomorphic-form-data/lib/index.js:2:18)\n at Module._compile (module.js:635:30)\n at Object.Module._extensions..js (module.js:646:10)\n at Module.load (module.js:554:32)\n at tryModuleLoad (module.js:497:12)\n at Function.Module._load (module.js:489:3)\n at Module.require (module.js:579:17)\n at require (internal/module.js:11:18)\n at Object. (/node_modules/swagger-client/dist/index.js:320:18)\n at webpack_require (/node_modules/swagger-client/dist/index.js:21:30)\n at Module. (/node_modules/swagger-client/dist/index.js:536:29)\n at webpack_require (/node_modules/swagger-client/dist/index.js:21:30)\n at Object. (/node_modules/swagger-client/dist/index.js:404:18)","exception":true,"date":"Mon May 18 2020 05:12:24 GMT+0000 (UTC)","process":{"pid":28,"uid":0,"gid":0,"cwd":"","execPath":"/usr/local/bin/node","version":"v8.9.3","argv":["/usr/local/bin/node","/server/server.js"],"memoryUsage":{"rss":91803648,"heapTotal":68247552,"heapUsed":44612592,"external":19084906}},"os":{"loadavg":[3.23388671875,1.9033203125,1.29248046875],"uptime":4488525},"trace":[{"column":10,"file":"vm.js","function":"createScript","line":80,"method":null,"native":false},{"column":10,"file":"vm.js","function":"Object.runInThisContext","line":139,"method":"runInThisContext","native":false},{"column":28,"file":"module.js","function":"Module._compile","line":599,"method":"_compile","native":false},{"column":10,"file":"module.js","function":"Module._extensions..js","line":646,"method":".js","native":false},{"column":32,"file":"module.js","function":"Module.load","line":554,"method":"load","native":false},{"column":12,"file":"module.js","function":"tryModuleLoad","line":497,"method":null,"native":false},{"column":3,"file":"module.js","function":"Module._load","line":489,"method":"_load","native":false},{"column":17,"file":"module.js","function":"Module.require","line":579,"method":"require","native":false},{"column":18,"file":"internal/module.js","function":"require","line":11,"method":null,"native":false},{"column":18,"file":"/node_modules/@tim-lai/isomorphic-form-data/lib/index.js","function":null,"line":2,"method":null,"native":false},{"column":30,"file":"module.js","function":"Module._compile","line":635,"method":"_compile","native":false},{"column":10,"file":"module.js","function":"Module._extensions..js","line":646,"method":".js","native":false},{"column":32,"file":"module.js","function":"Module.load","line":554,"method":"load","native":false},{"column":12,"file":"module.js","function":"tryModuleLoad","line":497,"method":null,"native":false},{"column":3,"file":"module.js","function":"Module._load","line":489,"method":"_load","native":false},{"column":17,"file":"module.js","function":"Module.require","line":579,"method":"require","native":false},{"column":18,"file":"internal/module.js","function":"require","line":11,"method":null,"native":false},{"column":18,"file":"/node_modules/swagger-client/dist/index.js","function":null,"line":320,"method":null,"native":false},{"column":30,"file":"/node_modules/swagger-client/dist/index.js","function":"__webpack_require","line":21,"method":null,"native":false},{"column":29,"file":"/node_modules/swagger-client/dist/index.js","function":null,"line":536,"method":null,"native":false},{"column":30,"file":"/node_modules/swagger-client/dist/index.js","function":"__webpack_require__","line":21,"method":null,"native":false},{"column":18,"file":"/node_modules/swagger-client/dist/index.js","function":null,"line":404,"method":null,"native":false}]}

octet-stream commented 4 years ago

Hello! According to your logs, you seem to run my library under Node v8.9.3 (see "execPath":"/usr/local/bin/node","version":"v8.9.3",), which does not support async iterators. The minimal required version by the library is 10.2 due to Node.js release schedule, which I'm following.

adrianjarc commented 4 years ago

Hello. I have same issue.

Yes I am running an API under NodeJS v8.x. But on the other hand I haven't manually added this package as dependency, it is a sub dependency of another package.

And just to clarify I don't allow any packages that i manually added to update from the version on which I added them. It is because those packages don't have fixed dependencies that this fail.

Could you still add backwards compatibility so older applications work?

Asking this because it would take me quite a while to update said API to newer node, since other packages don't work.

EDIT: Ok after some investigation I narrowed it down to package strong-soap, for which this package is like a level 4 dependency or something like that.

octet-stream commented 4 years ago

Hello. I have no plans to support Node < 10.2 anymore, as of the reason I mentioned before. If somebody need it to run on earlier Node.js versions, use the 1.x version of formdata-node. For others I can only advice to stick with those packages that does not include 2.x formdata-node.

octet-stream commented 4 years ago

Ok, as far as I can tell, this package is used as dependency at swagger-js (actually, it depends on this package which is depending on my library), so If somebody looking up here for the fix – don't use the latest version of swagger-js or update your Node to at least 10.2 version. This issue will be closed because I will stick with Node.js release schedule.

xcyxiner commented 4 years ago

getting this error while running my node application.

error: uncaughtException: Unexpected token /node_modules/formdata-node/lib/FormData.js:206 async __getField() { ^

SyntaxError: Unexpected token at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:599:28) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (/node_modules/@tim-lai/isomorphic-form-data/lib/index.js:2:18) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10) at Module.load (module.js:554:32) at tryModuleLoad (module.js:497:12) at Function.Module._load (module.js:489:3) at Module.require (module.js:579:17) at require (internal/module.js:11:18) at Object. (/node_modules/swagger-client/dist/index.js:320:18) at webpack_require (/node_modules/swagger-client/dist/index.js:21:30) at Module. (/node_modules/swagger-client/dist/index.js:536:29) at webpack_require (/node_modules/swagger-client/dist/index.js:21:30) at Object. (/node_modules/swagger-client/dist/index.js:404:18) {"error":{},"stack":"/node_modules/formdata-node/lib/FormData.js:206\n async __getField() {\n ^\n\nSyntaxError: Unexpected token *\n at createScript (vm.js:80:10)\n at Object.runInThisContext (vm.js:139:10)\n at Module._compile (module.js:599:28)\n at Object.Module._extensions..js (module.js:646:10)\n at Module.load (module.js:554:32)\n at tryModuleLoad (module.js:497:12)\n at Function.Module._load (module.js:489:3)\n at Module.require (module.js:579:17)\n at require (internal/module.js:11:18)\n at Object. (/node_modules/@tim-lai/isomorphic-form-data/lib/index.js:2:18)\n at Module._compile (module.js:635:30)\n at Object.Module._extensions..js (module.js:646:10)\n at Module.load (module.js:554:32)\n at tryModuleLoad (module.js:497:12)\n at Function.Module._load (module.js:489:3)\n at Module.require (module.js:579:17)\n at require (internal/module.js:11:18)\n at Object. (/node_modules/swagger-client/dist/index.js:320:18)\n at webpack_require (/node_modules/swagger-client/dist/index.js:21:30)\n at Module. (/node_modules/swagger-client/dist/index.js:536:29)\n at webpack_require (/node_modules/swagger-client/dist/index.js:21:30)\n at Object. (/node_modules/swagger-client/dist/index.js:404:18)","exception":true,"date":"Mon May 18 2020 05:12:24 GMT+0000 (UTC)","process":{"pid":28,"uid":0,"gid":0,"cwd":"","execPath":"/usr/local/bin/node","version":"v8.9.3","argv":["/usr/local/bin/node","/server/server.js"],"memoryUsage":{"rss":91803648,"heapTotal":68247552,"heapUsed":44612592,"external":19084906}},"os":{"loadavg":[3.23388671875,1.9033203125,1.29248046875],"uptime":4488525},"trace":[{"column":10,"file":"vm.js","function":"createScript","line":80,"method":null,"native":false},{"column":10,"file":"vm.js","function":"Object.runInThisContext","line":139,"method":"runInThisContext","native":false},{"column":28,"file":"module.js","function":"Module._compile","line":599,"method":"_compile","native":false},{"column":10,"file":"module.js","function":"Module._extensions..js","line":646,"method":".js","native":false},{"column":32,"file":"module.js","function":"Module.load","line":554,"method":"load","native":false},{"column":12,"file":"module.js","function":"tryModuleLoad","line":497,"method":null,"native":false},{"column":3,"file":"module.js","function":"Module._load","line":489,"method":"_load","native":false},{"column":17,"file":"module.js","function":"Module.require","line":579,"method":"require","native":false},{"column":18,"file":"internal/module.js","function":"require","line":11,"method":null,"native":false},{"column":18,"file":"/node_modules/@tim-lai/isomorphic-form-data/lib/index.js","function":null,"line":2,"method":null,"native":false},{"column":30,"file":"module.js","function":"Module._compile","line":635,"method":"_compile","native":false},{"column":10,"file":"module.js","function":"Module._extensions..js","line":646,"method":".js","native":false},{"column":32,"file":"module.js","function":"Module.load","line":554,"method":"load","native":false},{"column":12,"file":"module.js","function":"tryModuleLoad","line":497,"method":null,"native":false},{"column":3,"file":"module.js","function":"Module._load","line":489,"method":"_load","native":false},{"column":17,"file":"module.js","function":"Module.require","line":579,"method":"require","native":false},{"column":18,"file":"internal/module.js","function":"require","line":11,"method":null,"native":false},{"column":18,"file":"/node_modules/swagger-client/dist/index.js","function":null,"line":320,"method":null,"native":false},{"column":30,"file":"/node_modules/swagger-client/dist/index.js","function":"webpack_require","line":21,"method":null,"native":false},{"column":29,"file":"/node_modules/swagger-client/dist/index.js","function":null,"line":536,"method":null,"native":false},{"column":30,"file":"/node_modules/swagger-client/dist/index.js","function":"webpack_require","line":21,"method":null,"native":false},{"column":18,"file":"/node_modules/swagger-client/dist/index.js","function":null,"line":404,"method":null,"native":false}]}

+1,node 8.9.10,npm install ,node server.js is error

swagger-client version 3.10.3 ,dependencies "@tim-lai/isomorphic-form-data": "^1.0.0"(require node10).

swagger-client version 3.10.2 ,dependencies "isomorphic-form-data": "0.0.1",

"don't use the latest version of swagger-js " is good idea,but use "npm shrinkwrap" or "npm 5.x , package-lock.json" is better

npm install
npm install swagger-client@3.10.2
npm shrinkwrap

save npm-shrinkwrap.json to git ,next build "npm install"