Syntax error when ./nodebb upgrade
-
I followed the update instructions using git from the official support page to update my NodeBB by doing git fetch, and then resetting to the master branch and so on...
Upon running the upgrade script
./nodebb upgrade
, Tons of this happened all with success messages, then I finally got:2019-10-20T07:24:49.049Z [4567/19137] - error: [build] Encountered error during build stepEACCES: permission denied, rmdir '/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended' {"errno":-13,"code":"EACCES","syscall":"rmdir","path":"/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended","stack":"Error: EACCES: permission denied, rmdir '/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended'"} Error occurred during upgrade: Error: EACCES: permission denied, rmdir '/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended' 2019-10-20T07:24:49.053Z [4567/19137] - error: uncaughtException: EACCES: permission denied, rmdir '/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended' Error: EACCES: permission denied, rmdir '/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended' {"error":{"errno":-13,"code":"EACCES","syscall":"rmdir","path":"/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended"},"stack":"Error: EACCES: permission denied, rmdir '/var/www/nodebb/myforums/build/public/plugins/nodebb-plugin-emoji-extended'","exception":true,"date":"Sun Oct 20 2019 07:24:49 GMT+0000 (UTC)","process":{"pid":19137,"uid":1000,"gid":1000,"cwd":"/var/www/nodebb/myforums","execPath":"/home/gonia119/.nvm/versions/node/v8.16.2/bin/node","version":"v8.16.2","argv":["/home/gonia119/.nvm/versions/node/v8.16.2/bin/node","/var/www/nodebb/myforums/nodebb","upgrade"],"memoryUsage":{"rss":169865216,"heapTotal":124071936,"heapUsed":90725128,"external":19303888}},"os":{"loadavg":[1.15283203125,0.48291015625,0.27099609375],"uptime":5773},"trace":[]} 2019-10-20T07:24:49.054Z [4567/19137] - error: [build] requirejs modules build failed 2019-10-20T07:24:49.058Z [4567/19137] - error: [build] templates build failed 2019-10-20T07:24:49.060Z [4567/19137] - error: [build] languages build failed 2019-10-20T07:24:54.127Z [4567/19137] - error: [build] sounds build failed
Now, when I do
sudo ./nodebb upgrade
I get:admin@forums:/var/www/nodebb/myforums$ sudo ./nodebb upgrade /var/www/nodebb/myforums/src/cli/package-install.js:23 var packageContents = { ...oldPackageContents, ...defaultPackageContents, dependencies: { ...oldPackageContents.dependencies, ...defaultPackageContents.dependencies } }; ^^^ SyntaxError: Unexpected token ... at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object.<anonymous> (/var/www/nodebb/myforums/src/cli/index.js:8:22) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10)
I cannot get past this issue....
ENVIRONMENT INFORMATION:
Ubuntu 16.04.6 LTS
Node.js 8.16.2
Current NodeBB: Not sure because I cannot access my admin panel anymore... How can I get this info from the binary? I try ./nodebb version doesn't work...Trying to upgrade to: Latest NodeBB stable.
-
Looks like NodeBB no longer supports Node 8. I suggest upgrading to Node 12.
-
@PitaJ Thanks for your reply. Unfortunately this occurs with either 8 or 10.16.3. I use nvm so I just do a quick switch between them and I just tried 10.16.2 again and I get the same error.
By the way, is there a way to purge out the stuff that occurred in the upgrade script prior to it crashing? Im wondering if since I ran the original upgrade script on node 8 and it got a lot of the work done, then I hit the error, now I'm trying 10 but its after a bunch of the script already executed on 8, etc...
Or does the script just do a fresh start over every time it's executed?
-
I think just updating using git again (
git fetch
should be enough) should reset the upgrade.Or at least that worked for me in a dev environment where I broke the upgrade a few times
-
@oplik0 that's entirely incorrect.
git fetch
does literally nothing to local files, and even if it did,./nodebb upgrade
only affects the database and files that aren't handled by git.No rollback should be necessary, as that error occurred before the upgrade process actually made any changes.
@Todd actually it turns out that node 8 does support that syntax that's causing an error. I just noticed you're using
sudo
to run this command. Following a proper install, usingsudo
with any./nodebb
command shouldn't be necessary, and doing so usually means you're running the NodeBB server as root as well, which is dangerous.Try running
sudo node -v
, I bet root is using an older version. -
Ok thanks everyone. Good news is I made a lot of progress on this today. This was both a version and permission issue.
It was a version issue because thats what was causing the syntax error itself.
It was a permission issue because I should not have needed sudo in order to run the upgrade process and since I was running sudo, it was using an alternate version of Node rather than the one that I had selected using nvm.
So, I was able to fully upgrade.
-
@PitaJ said in Syntax error when ./nodebb upgrade:
@oplik0 that's entirely incorrect.
git fetch
does literally nothing to local files, and even if it did,./nodebb upgrade
only affects the database and files that aren't handled by git.Oh, possible. It probably fixed things for me because my problems were mostly due to me messing with NodeBB files. It seemed to reset the upgrade then, but that probably was because it didn't get to actually changing anything while I broke it.