agar-mini-map
agar-mini-map copied to clipboard
Linux server error: Unexpected reserved word
Hello,
I tried setting up the NodeJS server on my Raspberry Pi, and I got this error.
/home/pi/agar-mini-map-master/server/dist/server.js:1 import { Server ^^^^^^
module.js:434 var compiledWrapper = runInThisContext(wrapper, filename, true); ^ SyntaxError: Unexpected reserved word at Module._compile (module.js:434:25) at Object..js (module.js:464:10) at Module.load (module.js:353:32) at Function._load (module.js:311:12) at Array.0 (module.js:484:10) at EventEmitter._tickCallback (node.js:190:39)
npm ERR! [email protected] start: node dist/server.js
npm ERR! sh "-c" "node dist/server.js"
failed with 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the mini-map-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node dist/server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls mini-map-server
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.18.12+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "start"
npm ERR! cwd /home/pi/agar-mini-map-master/server
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] start: node dist/server.js
npm ERR! message sh "-c" "node dist/server.js"
failed with 1
npm ERR! errno {}
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
npm WARN /usr/share/doc/nodejs/README.Debian
npm WARN
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/agar-mini-map-master/server/npm-debug.log
npm not ok
Why am I receiving this error? Is it my fault or is it the server itself?
@rockthrower69 Please provide your environment and steps
I had nodejs already installed. I executed "sudo apt-get update" before executing the server. When I just execute "node server.js" I get this error.
root@rpi-anton-1:/home/pi/agar-mini-map-master/server/src# node server.js
/home/pi/agar-mini-map-master/server/src/server.js:1 import { Server ^^^^^^
module.js:434 var compiledWrapper = runInThisContext(wrapper, filename, true); ^ SyntaxError: Unexpected reserved word at Module._compile (module.js:434:25) at Object..js (module.js:464:10) at Module.load (module.js:353:32) at Function._load (module.js:311:12) at Array.0 (module.js:484:10) at EventEmitter._tickCallback (node.js:190:39)
Appearently "import" isn't correct NodeJS syntax. Maybe I have to install something before?
You should execute npm run start
instead of node src/server.js
. Have you executed npm run build
before?
Your node version is out-of-date. Upgrade your node package to v0.12 or upper. node -v
will print node's version.
"npm run build" is what I tried before, but I also got errors.
When I try to update NodeJS "nodejs is already the newest version.". "node --version" gives v0.6.19
/home/pi/agar-mini-map-master/server# npm run build
[email protected] build /home/pi/agar-mini-map-master/server babel src --out-dir dist
sh: 1: babel: not found
npm ERR! [email protected] build: babel src --out-dir dist
npm ERR! sh "-c" "babel src --out-dir dist"
failed with 127
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is most likely a problem with the mini-map-server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel src --out-dir dist
npm ERR! You can get their info via:
npm ERR! npm owner ls mini-map-server
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 3.18.12+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! cwd /home/pi/agar-mini-map-master/server
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] build: babel src --out-dir dist
npm ERR! message sh "-c" "babel src --out-dir dist"
failed with 127
npm ERR! errno {}
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
npm WARN /usr/share/doc/nodejs/README.Debian
npm WARN
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/agar-mini-map-master/server/npm-debug.log
npm not ok
You have to run npm install
first
rockthrower69 [email protected] 於 2015年8月15日週六 上午2:10 寫道:
/home/pi/agar-mini-map-master/server# npm run build
[email protected] build /home/pi/agar-mini-map-master/server babel src --out-dir dist
sh: 1: babel: not found
npm ERR! [email protected] build: babel src --out-dir dist npm ERR! sh "-c" "babel src --out-dir dist" failed with 127 npm ERR! npm ERR! Failed at the [email protected] build script.
npm ERR! This is most likely a problem with the mini-map-server package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system:
npm ERR! babel src --out-dir dist
npm ERR! You can get their info via: npm ERR! npm owner ls mini-map-server npm ERR! There is likely additional logging output above. npm ERR! npm ERR! System Linux 3.18.12+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "run" "build"
npm ERR! cwd /home/pi/agar-mini-map-master/server npm ERR! node -v v0.6.19 npm ERR! npm -v 1.1.4 npm ERR! code ELIFECYCLE
npm ERR! message [email protected] build: babel src --out-dir dist npm ERR! message sh "-c" "babel src --out-dir dist" failed with 127
npm ERR! errno {} npm WARN This failure might be due to the use of legacy binary "node" npm WARN For further explanations, please read npm WARN /usr/share/doc/nodejs/README.Debian npm WARN npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/pi/agar-mini-map-master/server/npm-debug.log npm not ok
—
Reply to this email directly or view it on GitHub https://github.com/dimotsai/agar-mini-map/issues/36#issuecomment-131197577 .
/home/pi/agar-mini-map-master/server# npm install npm http GET http://registry.npmjs.org/lodash npm http GET http://registry.npmjs.org/msgpack npm http GET http://registry.npmjs.org/object-assign npm http GET http://registry.npmjs.org/ws npm http GET http://registry.npmjs.org/debug npm http GET http://registry.npmjs.org/babel npm http 200 http://registry.npmjs.org/object-assign npm http 200 http://registry.npmjs.org/debug npm http 200 http://registry.npmjs.org/ws npm http 200 http://registry.npmjs.org/lodash
npm ERR! Error: No compatible version found: object-assign@'^3.0.0' npm ERR! No valid targets found. npm ERR! Perhaps not compatible with your version of node? npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)npm ERR! at /usr/share/npm/lib/cache.js:375:15 npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7) npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)npm ERR! You may report this log at: npm ERR! http://bugs.debian.org/npm npm ERR! or use npm ERR! reportbug --attach /home/pi/agar-mini-map-master/server/npm-debug.log npm npm ERR! npm ERR! System Linux 3.18.12+ npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! cwd /home/pi/agar-mini-map-master/server npm ERR! node -v v0.6.19 npm ERR! npm -v 1.1.4 npm ERR! message No compatible version found: object-assign@'^3.0.0' npm ERR! message No valid targets found. npm ERR! message Perhaps not compatible with your version of node? npm http 200 http://registry.npmjs.org/msgpack npm http 304 http://registry.npmjs.org/babel npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/pi/agar-mini-map-master/server/npm-debug.log npm not ok
Your node version is out of date. Please try to reinstall it
Already updated and reinstalled it. It stays the same version and says it is the highest. I use apt-get to install node and npm.
What is your Linux distribution? If your package manager does not provide the latest Node.js, you might want to build Node.js from source by yourself. I believe that all problems will be solved as long as you install the latest Node.
After encountering the above, and other, problems, and eventually getting agar-mini-map running on the Raspberry Pi, I thought I would leave the following comments for any others following in my footsteps:
- Use Raspbian "Jessie" distribution. I started with a fresh memory card and Jessie Lite after running out of space trying to perform the upgrade from Raspbian "wheezy" on my 4GB card.
- At the time of writing, agar-mini-map and the v4.x.x.x versions of NodeJS don't seem to work together. Install v0.12.6 of Node using the instructions found here: http://node-arm.herokuapp.com/ making sure you download "node_archive_armhf.deb," listed in the "other options", rather than the "latest" version.