{"id":772,"hash":"6b7a6bce728ddaac1cc48bd275dbb2f941c0a18c7d4484d1dc5a4377a38fe022","pattern":"Nodejs npm scripts fail with &quot;SyntaxError: Unexpected token {&quot;","full_message":"I've just imported my Reactjs project to a new machine on Ubuntu and installed most dependencies with npm install successfully bar the following:\n\nnpm WARN optional Skipping failed optional dependency /react-scripts/fsevents:\nnpm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.17\nnpm WARN optional Skipping failed optional dependency /chokidar/fsevents:\nnpm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.2\n\nTrying to run the project with npm start fails with:\n\n> booking-frontend@0.1.0 start /root/17-visit-booker-frontend\n> react-scripts start\n\n/root/17-visit-booker-frontend/node_modules/react-scripts/scripts/start.js:33\nconst {\n      ^\n\nSyntaxError: Unexpected token {\n    at exports.runInThisContext (vm.js:53:16)\n    at Module._compile (module.js:374:25)\n    at Object.Module._extensions..js (module.js:417:10)\n    at Module.load (module.js:344:32)\n    at Function.Module._load (module.js:301:12)\n    at Function.Module.runMain (module.js:442:10)\n    at startup (node.js:136:18)\n    at node.js:966:3\n\nnpm ERR! Linux 4.4.0-81-generic\nnpm ERR! argv \"/usr/bin/nodejs\" \"/usr/bin/npm\" \"start\"\nnpm ERR! node v4.2.6\nnpm ERR! npm  v3.5.2\nnpm ERR! code ELIFECYCLE\nnpm ERR! booking-frontend@0.1.0 start: `react-scripts start`\nnpm ERR! Exit status 1\nnpm ERR! \nnpm ERR! Failed at the booking-frontend@0.1.0 start script 'react-scripts start'.\nnpm ERR! Make sure you have the latest version of node.js and npm installed.\nnpm ERR! If you do, this is most likely a problem with the booking-frontend package,\nnpm ERR! not with npm itself.\nnpm ERR! Tell the author that this fails on your system:\nnpm ERR!     react-scripts start\nnpm ERR! You can get information on how to open an issue for this project with:\nnpm ERR!     npm bugs booking-frontend\nnpm ERR! Or if that isn't available, you can get their info via:\nnpm ERR!     npm owner ls booking-frontend\nnpm ERR! There is likely additional logging output above.\n\nnpm ERR! Please include the following file with any support request:\nnpm ERR!     /root/17-visit-booker-frontend/npm-debug.log\n\nAttempting to run any npm script including npm run build all fails with the exact same error referencing the same lines in each file in the SyntaxError:\n\nSyntaxError: Unexpected token {\n    at exports.runInThisContext (vm.js:53:16)\n    at Module._compile (module.js:374:25)\n    at Object.Module._extensions..js (module.js:417:10)\n    at Module.load (module.js:344:32)\n    at Function.Module._load (module.js:301:12)\n    at Function.Module.runMain (module.js:442:10)\n    at startup (node.js:136:18)\n    at node.js:966:3\n\nRunning the same scripts on my original machine, a Mac, succeed.\n\nI've tried re-installing node/npm which do not fix the issue. Is the supposedly optional dependency causing this to fail?\n\nAny help is appreciated.","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"You're using node.js v4 which does not by default support destructuring syntax (the const {field1, field2, ....} = object) that it is failing on. \n\nYou have two options:\n\nInstall a newer version of Node.js\nRun node with the harmony flags that will enable this feature in version 4.x.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/45108189/nodejs-npm-scripts-fail-with-syntaxerror-unexpected-token","votes":7,"created_at":"2026-04-19T04:51:39.469500+00:00","updated_at":"2026-04-19T04:51:39.469500+00:00"}