Describe the bug
> @freecodecamp/[email protected] bootstrap /app
> lerna bootstrap --ci
lerna notice cli v3.16.4
lerna info versioning independent
lerna info ci enabled
lerna info Bootstrapping 10 packages
lerna info Installing external dependencies
lerna ERR!
(node:46) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/app/lerna-debug.log.502291454'
at Object.openSync (fs.js:440:3)
at Function.writeFileSync [as sync] (/app/node_modules/write-file-atomic/index.js:212:13)
at writeLogFile (/app/node_modules/@lerna/write-log-file/write-log-file.js:30:19)
at /app/node_modules/@lerna/command/index.js:72:13
(node:46) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:46) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
added 1349 packages in 13.868s
> @freecodecamp/[email protected] docker:seed /disk480/www/external/freeCodeCamp/freeCodeCamp
> docker-compose run --rm freecodecamp npm run seed
Starting freecodecamp_mailhog_1 ... done
Starting freecodecamp_db_1 ... done
> @freecodecamp/[email protected] seed /app
> npm-run-all -p seed:*
> @freecodecamp/[email protected] seed:challenges /app
> cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges
> @freecodecamp/[email protected] seed:auth-user /app
> cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'mongodb'
Require stack:
- /app/tools/scripts/seed/seedChallenges.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/app/tools/scripts/seed/seedChallenges.js:4:35)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/tools/scripts/seed/seedChallenges.js' ]
}
internal/modules/cjs/loader.js:800
throw err;
^
Error: Cannot find module 'mongodb'
Require stack:
- /app/tools/scripts/seed/seedAuthUser.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/app/tools/scripts/seed/seedAuthUser.js:3:21)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/tools/scripts/seed/seedAuthUser.js' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] seed:challenges: `cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] seed:challenges script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] seed:auth-user: `cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] seed:auth-user 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! /home/node/.npm/_logs/2019-12-22T01_54_42_990Z-debug.log
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2019-12-22T01_54_42_994Z-debug.log
ERROR: "seed:challenges" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] seed: `npm-run-all -p seed:*`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] seed 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! /home/node/.npm/_logs/2019-12-22T01_54_43_023Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] docker:seed: `docker-compose run --rm freecodecamp npm run seed`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] docker:seed 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! /home/fi1osof/.npm/_logs/2019-12-22T01_54_43_436Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] docker:run-once: `npm run docker:init && npm run docker:install && npm run docker:seed`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] docker:run-once 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! /home/fi1osof/.npm/_logs/2019-12-22T01_54_43_451Z-debug.log
To Reproduce
Steps to reproduce the behavior:
Instruction: https://github.com/freeCodeCamp/freeCodeCamp/blob/master/docs/how-to-setup-freecodecamp-locally.md
npm run docker:run-once
Desktop (please complete the following information):
Distributor ID: Ubuntu
Description: Ubuntu 19.10
Release: 19.10
Codename: eoan
node v10.17.0
npm v6.11.3
Docker version 19.03.2, build 6a30dfca03
docker-compose version 1.25.0, build 0a186604
It seems like a permission issue. What's the output of npm run docker:init
?
@ojeytonwilliams
npm run docker:init
> @freecodecamp/[email protected] docker:init /disk480/www/external/freeCodeCamp/freeCodeCamp
> docker-compose run -u root --rm freecodecamp bash change_volumes_owner.sh && docker-compose run -u root --rm client bash -c "cd .. && bash change_volumes_owner.sh" && docker-compose run -u root --rm api-server bash -c "cd .. && bash change_volumes_owner.sh"
Creating freecodecamp_mailhog_1 ... done
Creating freecodecamp_db_1 ... done
Starting freecodecamp_db_1 ... done
Starting freecodecamp_mailhog_1 ... done
Error on npm run docker:install
$ npm run docker:install
> @freecodecamp/[email protected] docker:install /disk480/www/external/freeCodeCamp/freeCodeCamp
> docker-compose run --rm freecodecamp npm ci
Starting freecodecamp_db_1 ... done
Starting freecodecamp_mailhog_1 ... done
npm WARN prepare removing existing node_modules/ before installation
> [email protected] install /app/node_modules/fsevents
> node install
> [email protected] install /app/node_modules/husky
> node husky install
husky > setting up git hooks
husky > failed to install
EACCES: permission denied, open '/app/.git/hooks/applypatch-msg'
> @freecodecamp/[email protected] postinstall /app
> npm run bootstrap
> @freecodecamp/[email protected] bootstrap /app
> lerna bootstrap --ci
lerna notice cli v3.16.4
lerna info versioning independent
lerna info ci enabled
lerna info Bootstrapping 10 packages
lerna info Installing external dependencies
lerna ERR!
(node:46) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/app/lerna-debug.log.502291454'
at Object.openSync (fs.js:440:3)
at Function.writeFileSync [as sync] (/app/node_modules/write-file-atomic/index.js:212:13)
at writeLogFile (/app/node_modules/@lerna/write-log-file/write-log-file.js:30:19)
at /app/node_modules/@lerna/command/index.js:72:13
(node:46) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:46) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
added 1349 packages in 14.52s
I'd recommend investigating how to use Docker with an external drive (I assume that's what you're doing). If that fails, please reach out on Gitter.
I'm closing this, though, because it doesn't seem to be a bug.
@ojeytonwilliams
I do not use external drive. And i just download repo and run script via package.json. And this is not working for me.
I understand that you do not owe me anything. I just reported a problem.
Sorry, I was a bit premature closing this. I assumed that /disk480/www/external/freeCodeCamp/freeCodeCamp
was an external drive, because, well, it has external
in it!
Anyway, I'm re-opening this for now, in case anyone has some insight on this. However, I still think you're more likely to reach people that can help you on Gitter or the forums.
Maybe try to add sudo before the command, and try this again
@LarryHu0217 I have tried
@Fi1osof Check the vision if it is satisfied with the contribution guideline's requirement.
having the same issue two!
What you did ?
My computer runs:
Distributor ID: Debian
Description: Kali GNU/Linux Rolling
Release: 5.2.0-kali3-amd64
-Bash output:
> @freecodecamp/[email protected] docker:run-once /root/freeCodeCamp
> npm run docker:init && npm run docker:install && npm run docker:seed
> @freecodecamp/[email protected] docker:init /root/freeCodeCamp
> docker-compose run -u root --rm freecodecamp bash change_volumes_owner.sh && docker-compose run -u root --rm client bash -c "cd .. && bash change_volumes_owner.sh" && docker-compose run -u root --rm api-server bash -c "cd .. && bash change_volumes_owner.sh"
Starting freecodecamp_db_1_ff6577bf8c77 ... done
Starting freecodecamp_mailhog_1_41cfd23b8f8e ... done
Starting freecodecamp_mailhog_1_41cfd23b8f8e ... done
Starting freecodecamp_db_1_ff6577bf8c77 ... done
> @freecodecamp/[email protected] docker:install /root/freeCodeCamp
> docker-compose run --rm freecodecamp npm ci
Starting freecodecamp_db_1_ff6577bf8c77 ... done
Starting freecodecamp_mailhog_1_41cfd23b8f8e ... done
npm WARN prepare removing existing node_modules/ before installation
> [email protected] install /app/node_modules/fsevents
> node-gyp rebuild
make: Entering directory '/app/node_modules/fsevents/build'
SOLINK_MODULE(target) Release/obj.target/.node
COPY Release/.node
make: Leaving directory '/app/node_modules/fsevents/build'
> [email protected] install /app/node_modules/husky
> node husky install
husky > setting up git hooks
husky > failed to install
EACCES: permission denied, open '/app/.git/hooks/applypatch-msg'
> @freecodecamp/[email protected] postinstall /app
> npm run bootstrap
> @freecodecamp/[email protected] bootstrap /app
> lerna bootstrap --ci
lerna notice cli v3.20.2
lerna info versioning independent
lerna info ci enabled
lerna info Bootstrapping 10 packages
lerna info Installing external dependencies
lerna ERR!
(node:71) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/app/lerna-debug.log.887104264'
at Object.openSync (fs.js:440:3)
at Function.writeFileSync [as sync] (/app/node_modules/write-file-atomic/index.js:203:17)
at writeLogFile (/app/node_modules/@lerna/write-log-file/write-log-file.js:30:19)
at /app/node_modules/@lerna/command/index.js:74:13
(node:71) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:71) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
added 1337 packages in 87.909s
> @freecodecamp/[email protected] docker:seed /root/freeCodeCamp
> docker-compose run --rm freecodecamp npm run seed
Starting freecodecamp_mailhog_1_41cfd23b8f8e ... done
Starting freecodecamp_db_1_ff6577bf8c77 ... done
> @freecodecamp/[email protected] seed /app
> npm-run-all -p seed:*
> @freecodecamp/[email protected] seed:auth-user /app
> cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser
> @freecodecamp/[email protected] seed:challenges /app
> cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module 'mongodb'
Require stack:
- /app/tools/scripts/seed/seedAuthUser.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/app/tools/scripts/seed/seedAuthUser.js:3:21)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/tools/scripts/seed/seedAuthUser.js' ]
}
internal/modules/cjs/loader.js:796
throw err;
^
Error: Cannot find module 'mongodb'
Require stack:
- /app/tools/scripts/seed/seedChallenges.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
at Function.Module._load (internal/modules/cjs/loader.js:686:27)
at Module.require (internal/modules/cjs/loader.js:848:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/app/tools/scripts/seed/seedChallenges.js:4:35)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/tools/scripts/seed/seedChallenges.js' ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] seed:auth-user: `cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] seed:auth-user script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] seed:challenges: `cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] seed:challenges 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! /home/node/.npm/_logs/2020-02-08T22_11_10_994Z-debug.log
npm ERR! A complete log of this run can be found in:
npm ERR! /home/node/.npm/_logs/2020-02-08T22_11_11_012Z-debug.log
ERROR: "seed:auth-user" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] seed: `npm-run-all -p seed:*`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] seed 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! /home/node/.npm/_logs/2020-02-08T22_11_11_113Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] docker:seed: `docker-compose run --rm freecodecamp npm run seed`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] docker:seed 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-02-08T22_11_12_196Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/[email protected] docker:run-once: `npm run docker:init && npm run docker:install && npm run docker:seed`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @freecodecamp/[email protected] docker:run-once 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-02-08T22_11_12_287Z-debug.log`
i've tried tried all solution i could get online still get the same error
but what i've figured out the problem starts when trying to install (husky)
[email protected] install /app/node_modules/husky
node husky install
husky > setting up git hooks
husky > failed to install
EACCES: permission denied, open '/app/.git/hooks/applypatch-msg'
is the any way i can bypass husky install ?
is the any way i can bypass husky install ?
That would be fixing a symptom of the problem. I think that the root cause is the lack of permissions, and if you solve that husky should work fine. I recommend searching for docker permissions problem and seeing if any of the fixes apply to you.
ok thank i'll get to it right away
is the any way i can bypass husky install ?
That would be fixing a symptom of the problem. I think that the root cause is the lack of permissions, and if you solve that husky should work fine. I recommend searching for docker permissions problem and seeing if any of the fixes apply to you.
i did the research and the answer to my problem was the root account, apparently you only need sudo to run docker service and not to run containers
`> @freecodecamp/[email protected] docker:install /home/User1/freeCodeCamp
docker-compose run --rm freecodecamp npm ci
Starting freecodecamp_db_1_af3a31cc328c ... done
Starting freecodecamp_mailhog_1_80350c2e9c0e ... done
npm WARN prepare removing existing node_modules/ before installation
[email protected] install /app/node_modules/fsevents
node install
[email protected] install /app/node_modules/husky
node husky install
husky > setting up git hooks
husky > done
@freecodecamp/[email protected] postinstall /app
npm run bootstrap
@freecodecamp/[email protected] bootstrap /app
lerna bootstrap --ci
lerna notice cli v3.16.4
lerna info versioning independent
lerna info ci enabled
lerna info Bootstrapping 10 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna success Bootstrapped 10 packages
added 1349 packages in 1682.734s
@freecodecamp/[email protected] docker:seed /home/User1/freeCodeCamp
docker-compose run --rm freecodecamp npm run seed
Starting freecodecamp_db_1_af3a31cc328c ... done
Starting freecodecamp_mailhog_1_80350c2e9c0e ... done
@freecodecamp/[email protected] seed /app
npm-run-all -p seed:*
@freecodecamp/[email protected] seed:challenges /app
cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges
@freecodecamp/[email protected] seed:auth-user /app
cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser
fcc:tools:seedLocalAuthUser Connected successfully to mongo +0ms
fcc:tools:seedLocalAuthUser local auth user seed complete +235ms
fcc:tools:seedChallenges Connected successfully to mongo at mongodb://db:27017/freecodecamp +0ms
fcc:tools:seedChallenges deleted all the challenges +51ms
fcc:tools:seedChallenges generating path migration map +17s
fcc:tools:seedChallenges path migration map generated +250ms
fcc:tools:seedChallenges challenge seed complete +177ms`
thanks to you bro ojeytonwilliams
No problem, @bonginkosif. Is everything working for you now? If so, what did you do differently? It would be great to see if there's something that needs changing in the docs. Something to help avoid the problems you were having.
No problem, @bonginkosif. Is everything working for you now? If so, what did you do differently? It would be great to see if there's something that needs changing in the docs. Something to help avoid the problems you were having.
Sorry for my late reply.... As you pointed out on your earlier comment about the root account permission, docker and mongod services must be run with a root privilege, on the search i did i found out you cant run containers with root account .
but for does who dont want to change the root account like me just need to create an additional account and on your terminal just need to change account by using su username
if you are using root account by default and run your setup it will complete with no errors
on my kali system thats what i did
and dont run sudo npm run docker:run-once
just run npm run docker:run-once
if you dont want your setup to fail
got the answer here:
https://medium.com/@mccode/processes-in-containers-should-not-run-as-root-2feae3f0df3b
one last thing with mongodb u must create an admin user then run mongod --port 27017 --dbpath /data/db
mongo --port 27017
mongod --auth --port 27017 --dbpath /data/db
mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin"
and make sure you are permitted to read and write on /data/db and add security configuration /etc/mongod.conf
by running sudo nano /etc/mongod.conf
like this security:
authorization: enabled
check mongodb Docs for more details on creating an AdminUser and more to setup Mongodb
@bonginkosif thanks for letting us know. Just to make sure I understand correctly, the main problem was that you were logged in as root? You switched to a normal user and then it worked?
If that's the case I'll create a PR for the docs highlighting that you should not run as root.
yes i am using a root account for everything, then i had to create an additional user just for freecodecamp. and yes root is bad for docker and mongodb containers.
and one last thing i think you should add the part were people should create an admin user and take ownership of data/db
and etc/mongod.conf
after installing mongodb on linux and edit mongod.conf
security line
Thanks, we have retired the docker setup for the lack of maintenance. We understand the need for isolation by some and recommend using GitPod instead.
Most helpful comment
Sorry, I was a bit premature closing this. I assumed that
/disk480/www/external/freeCodeCamp/freeCodeCamp
was an external drive, because, well, it hasexternal
in it!Anyway, I'm re-opening this for now, in case anyone has some insight on this. However, I still think you're more likely to reach people that can help you on Gitter or the forums.