brentvollebregt/monopoly-money

Cannot install on FreeBSD as root

MayCMD opened this issue · 19 comments

Hello I am new to this, in fact it is the first time that I use nodejs, I have followed the instructions but I cannot make it work. I am installing it from a jail freenas FreeBSD, but when building it generates this error:

root@MonoMoney:/usr/local/share/monopoly-money # npm run build npm WARN >npm npm does not support Node.js v14.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
npm WARN npm You can find the latest version at https://nodejs.org/

monopoly-money@ build /usr/local/share/monopoly-money
cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd ../../ >&& node postbuild.js

npm WARN npm npm does not support Node.js v14.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
npm WARN npm You can find the latest version at https://nodejs.org/

@monopoly-money/game-state@0.0.0 build /usr/local/share/monopoly-money/packages/game-state
tsc

sh: tsc: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @monopoly-money/game-state@0.0.0 build: tsc
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @monopoly-money/game-state@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-27T16_31_21_293Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run build && cd >../client && npm run build && cd ../../ && node postbuild.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the monopoly-money@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-27T16_31_21_325Z-debug.log

I don't know what I'm missing or doing wrong. If you could please help me in giving me more detailed instructions considering that I have little experience, I will be very grateful!

What command are you executing here? Could you provide for reproduction steps?

Hi! thanks for your time.
I am doing everything from a Freenas server (FreeBSD), create a jail (FreeBSD), run the following commands:

pkg update
pkg upgrade
pkg install git
cd /usr/local/share/
git clone https://github.com/brentvollebregt/monopoly-money.git
pkg install npm
cd /usr/local/share/monopoly-money/packages/server/
cp .env.example .env
cd /usr/local/share/monopoly-money/packages/client
cp .env.example .env
npm run build

From the command "npm run build" it generates the error of the previous message.

I don't know if I'm doing something wrong or missing something.
It is the first time that I use nodejs

Thank you

It doesn't appear you have followed step 2 in the setup instructions: Run npm install

If I did, the difference is that in FreeBSD the command to install is "pkg install npm", I think with ubuntu if it is "npm install". The command will be executed right after cloning the repo

Based on what I read on the Node.js docs, it looks like pkg install node is used to install Node, not to install the dependencies.

the command i execute is >pkg install npm. Not >pkg install node
I have tried the installation again to make sure all the dependencies are installed, and these are the ones that show me:

root@Monomonop:/usr/local/share # pkg install npm
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 6 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
c-ares: 1.16.1
gmake: 4.3_2
icu: 67.1,1
libuv: 1.38.0
node: 14.4.0
npm: 6.12.1_1

Number of packages to be installed: 6

The process will require 109 MiB more space.
22 MiB to be downloaded.

Proceed with this action? [y/N]:

installing npm also installs node along with other packages

Sorry, I see I got that small detail wrong. What I am saying, is that if pkg install node installs node, then does pkg install npm not install npm? That is not what npm install does.

Have you tried to run npm install like in the docs and per my recommendation above? npm should work the same on most OS's regarding it's installed.

If what you say is true, sorry, I was wrong in the command.
certainly the pgk install command is to install the packages, which I did and installed everything correctly, both git, nodejs, and npm.
And the command "npm install" is typical of npm and it needed to be run to finish installing all the dependencies, that command I did not do, sorry.
Upon realizing it, I run it and install all dependencies for the repo. but still the error continues when executing "npm run buil":

root@MoneyPoly:/usr/share/github/monopoly-money # npm run build
npm WARN npm npm does not support Node.js v14.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
npm WARN npm You can find the latest version at https://nodejs.org/

monopoly-money@ build /usr/share/github/monopoly-money
cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd ../../ >&& node postbuild.js

npm WARN npm npm does not support Node.js v14.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
npm WARN npm You can find the latest version at https://nodejs.org/

@monopoly-money/game-state@0.0.0 build /usr/share/github/monopoly-money/packages/game-state
tsc

sh: tsc: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @monopoly-money/game-state@0.0.0 build: tsc
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @monopoly-money/game-state@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-29T16_42_36_848Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run build && cd >../client && npm run build && cd ../../ && node postbuild.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the monopoly-money@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-29T16_42_36_875Z-debug.log

Seeing the log file npmm shows the following:

0 info it worked if it ends with ok
1 warn npm npm does not support Node.js v14.4.0
2 warn npm You should probably upgrade to a newer version of node as we
3 warn npm can't make any promises that npm will work with this version.
4 warn npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.
5 warn npm You can find the latest version at https://nodejs.org/
6 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
7 info using npm@6.12.1
8 info using node@v14.4.0
9 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
10 info lifecycle monopoly-money@~prebuild: monopoly-money@
11 info lifecycle monopoly-money@~build: monopoly-money@
12 verbose lifecycle monopoly-money@~build: unsafe-perm in lifecycle true
13 verbose lifecycle monopoly-money@~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node->gy>
14 verbose lifecycle monopoly-money@~build: CWD: /usr/share/github/monopoly-money
15 silly lifecycle monopoly-money@~build: Args: [
15 silly lifecycle '-c',
15 silly lifecycle 'cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && np>
15 silly lifecycle ]
16 silly lifecycle monopoly-money@~build: Returned: code: 1 signal: null
17 info lifecycle monopoly-money@~build: Failed to exec build script
18 verbose stack Error: monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run b>
18 verbose stack Exit status 1
18 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.j>
18 verbose stack at EventEmitter.emit (events.js:315:20)
18 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spa>
18 verbose stack at ChildProcess.emit (events.js:315:20)
18 verbose stack at maybeClose (internal/child_process.js:1051:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
19 verbose pkgid monopoly-money@
20 verbose cwd /usr/share/github/monopoly-money
21 verbose FreeBSD 11.3-RELEASE-p9
22 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
23 verbose node v14.4.0
24 verbose npm v6.12.1
25 error code ELIFECYCLE
26 error errno 1
27 error monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run build && cd ../c>
27 error Exit status 1
28 error Failed at the monopoly-money@ build script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]

Also try doing it with Ubuntu Server 18.04 and it shows the same error. any idea what is going on?

Or if you can give me the steps and what S.O you use to make everything work well, I will be very grateful.

You seem to be having messages like

npm WARN npm npm does not support Node.js v14.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12, 13.

Maybe try using Node 13 rather than Node 14? This doesn't seem like an error associated with this project.

Hello, I did the tests with nodejs versions v12.18.2 (13 I couldn't find it) and npm v6.12.1.

The compatibility error disappeared, but the error "ERR! Code ELIFECYCLE" and the others still persist.

I do not know what to do. :(

root@MoneyPoly:/usr/local/git/monopoly-money # npm run build

monopoly-money@ build /usr/local/git/monopoly-money
cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd ../../ && node postbuild.js

@monopoly-money/game-state@0.0.0 build /usr/local/git/monopoly-money/packages/game-state
tsc

sh: tsc: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @monopoly-money/game-state@0.0.0 build: tsc
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @monopoly-money/game-state@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-30T17_17_40_228Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd >../../ && node postbuild.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the monopoly-money@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-07-30T17_17_40_248Z-debug.log

I thought it was for the warning npm WARN Local package.json exists, but node_modules missing, did you mean to install?, but checking in the folder, if the directory node_modules appears.

root@MoneyPoly:/usr/local/git/monopoly-money # ls
.git .vscode package.json tslint.json
..github lerna.json packages
.gitignore node_modules postbuild.js
.prettierrc package-lock.json README.md
root@MoneyPoly:/usr/local/git/monopoly-money #

Log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@6.12.1
3 info using node@v12.18.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle monopoly-money@~prebuild: monopoly-money@
6 info lifecycle monopoly-money@~build: monopoly-money@
7 verbose lifecycle monopoly-money@~build: unsafe-perm in lifecycle true
8 verbose lifecycle monopoly-money@~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/local/git/monopoly->money/node_modules/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/b>
9 verbose lifecycle monopoly-money@~build: CWD: /usr/local/git/monopoly-money
10 silly lifecycle monopoly-money@~build: Args: [
10 silly lifecycle '-c',
10 silly lifecycle 'cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd ../../ && node postbuild.js'
10 silly lifecycle ]
11 silly lifecycle monopoly-money@~build: Returned: code: 1 signal: null
12 info lifecycle monopoly-money@~build: Failed to exec build script
13 verbose stack Error: monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd ../../ && node postbuild.js
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid monopoly-money@
15 verbose cwd /usr/local/git/monopoly-money
16 verbose FreeBSD 11.3-RELEASE-p9
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v12.18.2
19 verbose npm v6.12.1
20 error code ELIFECYCLE
21 error errno 1
22 error monopoly-money@ build: cd packages/game-state && npm run build && cd ../server && npm run build && cd ../client && npm run build && cd ../../ && node postbuild.js
22 error Exit status 1
23 error Failed at the monopoly-money@ build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

It seems that the internal package monopoly-money/game-state may not have it's corresponding node_modules folder. If you run npm install again, are there any errors that appear?

Yes, I run npm install several times, dependencies and folder node_modules are installed but the same error continues. Will the ELIFECYCLE error have something to do with it?

The installation of the environment variables what I do is copy them according to the instructions step. but I just do that. I don't modify anything inside the .env file since I don't know what to modify and I don't know if necessary the REACT_APP_GOOGLE_ANALYTICS_TRACKING_ID = UA-XXXXXXXXX-X. since I do not modify it. I don't know if this is the root of the problem. I have also tried deleting that line but the error continues.

If that is the problem, can you help me how to install the environment variables? I didn't understand that part of the step very much.

Thanks

If you go to packages/game-state, is a folder node_modules in there also?

In terms of the environment variables, the README states:

Copy the .env.example files in the server and client packages and populate them:

  • Examples are at: packages/server/.env.example and packages/client/.env.example
  • Copy these using cp .env.example .env and populate them both.

So yes, you need to populate them both but the defaults should be fine; you can remove REACT_APP_GOOGLE_ANALYTICS_TRACKING_ID without any issues if you want, the app will handle this. Although these environment variables will have nothing to do with the build phase which you are having issues with.

If you run npm install again, are there any errors that appear?

Yes, the first time I run npm install I get this error:
root@MoneyPoly:/usr/local/git/monopoly-money # npm install
npm WARN lifecycle monopoly-money@~postinstall: cannot run in wd monopoly-money@ npm run bootstrap (wd=/usr/local/git/monopoly-money)
added 715 packages from 385 contributors and audited 715 packages in 23.551s
found 43 vulnerabilities (22 low, 21 high)
run npm audit fix to fix them, or npm audit for details
root@MoneyPoly:/usr/local/git/monopoly-money #

and then the second time I do it the same error appears above and then this one:
root@MoneyPoly:/usr/local/git/monopoly-money # npm install
npm WARN lifecycle monopoly-money@~postinstall: cannot run in wd monopoly-money@ npm run bootstrap (wd=/usr/local/git/monopoly-money)
npm WARN tslint@5.20.1 requires a peer of typescript@>=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@2.29.0 requires a peer of typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev but none is installed. You must install peer dependencies yourself.
audited 715 packages in 7.758s
found 43 vulnerabilities (22 low, 21 high) run npm audit fix to fix them, or npm audit for details
root@MoneyPoly:/usr/local/git/monopoly-money #

If you go to packages/game-state, is a folder node_modules in there also?

No, after running npm install twice, that folder still doesn't appear;
root@MoneyPoly:/usr/local/git/monopoly-money/packages/game-state # ls
package-lock.json src
package.json tsconfig.json
root@MoneyPoly:/usr/local/git/monopoly-money/packages/game-state #

Hello friend, I already solved the problem. I started researching more about npm and found in the documentation that npm and bootstrap don't work well when using the root user, I've been testing on freebsd and ubuntu server, so the user was root.

what i have done is run the npm commands with the option: --unsafe-perm. and this has solved everything;

npm install --unsafe-perm
npm --unsafe-perm run build
npm --unsafe-perm start

I already managed to lift everything and it's working!
Thank you very much for your time and for the help.

What I'm seeing is that when creating a game, on the funds page when someone makes a transaction, the recent transactions do not appear at the bottom. Do you have any idea why they are not seen?

Looking at the hosted demo at monopoly-money.nitratine.net, when you make a transaction, the transaction will appear at the bottom of the "funds" page.

Do note that they only appear for 10 seconds and then disappear.

Did notice that at the monopoly-money.nitratine.net demo. But the local implementation is not even shown the 10 seconds.

Does environment variables have anything to do with it?
The variable in packages/server SERVER_ALLOWED_ORIGINS=http://localhost:3000 leaves it as it is because I don't understand what it does.

the packages/client variable if I change it to SERVER_ALLOWED_ORIGINS=http://Local_IP_Addres:5000 to allow me to create a new game since I am accessing it remotely from the IP address.

I have tested it locally and at monopoly-money.nitratine.net and they both show the messages for 10 seconds. The environment variables have nothing to do with this - I linked the file above that controls the 10-second timeout.

SERVER_ALLOWED_ORIGINS is defined in the README as:

The origins that are served by the server. Not setting this is the equivalent of setting CORS to *.

packages/client does not use SERVER_ALLOWED_ORIGINS.

Since the original issue has been solved, I'm going to close this issue.

You can open another issue for a separate issue or clarification if you wish.