freeCodeCamp: Unable to run npm ci on Windows with latest version of master branch

Because I go back and forth between the master branch (to test PRs hitting master) and next-curriculum (to work on the project-based curriculum), sometimes in the same day I will go back and forth 2-3 times. As recent as two days ago, I was able to successfully run npm ci and npm run develop on the latest master branch with no issues.

I am not exactly sure what PR merged to cause me trouble on my Windows machine, but even after doing the following:

cp sample.env .env
npm run clean
npm ci

I still get the error shown at the bottom after npm ci executes. I even tried deleting the repo locally, re-cloning it, and following all the docs steps again, but still get the error. It seems to be related to node-gyp.

OPT@HP-PC MINGW64 /d/coding/fcc (master)
$ npm run clean

> @freecodecamp/freecodecamp@0.0.1 clean D:\coding\fcc
> npm-run-all clean:client clean:server clean:packages


> @freecodecamp/freecodecamp@0.0.1 clean:client D:\coding\fcc
> cd ./client && npm run clean

The system cannot find the path specified.

> @freecodecamp/client@1.0.0 clean D:\Coding\fcc\client
> gatsby clean

info Deleting .cache, public
info Successfully deleted directories

> @freecodecamp/freecodecamp@0.0.1 clean:server D:\coding\fcc
> shx rm -rf ./api-server/lib


> @freecodecamp/freecodecamp@0.0.1 clean:packages D:\coding\fcc
> lerna clean -y

lerna notice cli v3.22.0
lerna info versioning independent
lerna info clean removing D:\coding\fcc\api-server\node_modules
lerna info clean removing D:\coding\fcc\client\node_modules
lerna info clean removing D:\coding\fcc\client\plugins\fcc-source-challenges\node_modules
lerna info clean removing D:\coding\fcc\client\plugins\gatsby-remark-fcc-forum-emoji\node_modules
lerna info clean removing D:\coding\fcc\client\plugins\gatsby-remark-node-identity\node_modules
lerna info clean removing D:\coding\fcc\curriculum\node_modules
lerna info clean removing D:\coding\fcc\search-indexing\node_modules
lerna info clean removing D:\coding\fcc\tools\challenge-md-parser\node_modules
lerna info clean removing D:\coding\fcc\tools\scripts\build\node_modules
lerna info clean removing D:\coding\fcc\tools\scripts\seed\node_modules
lerna success clean finished

OPT@HP-PC MINGW64 /d/coding/fcc (master)
$ npm ci
npm WARN prepare removing existing node_modules/ before installation

> fsevents@1.2.12 install D:\coding\fcc\node_modules\fsevents
> node-gyp rebuild


D:\coding\fcc\node_modules\fsevents>if not defined npm_config_node_gyp (node "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Traceback (most recent call last):
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 50, in <module>
    sys.exit(gyp.script_main())
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 554, in script_main
    return main(sys.argv[1:])
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 547, in main
    return gyp_main(args)
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 532, in gyp_main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 2030, in GenerateOutput
    sln_projects, project_objects, flat=msvs_version.FlatSolution())
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1787, in _GatherSolutionFolders
    return _DictsToFolders('', root, flat)
  File "C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\generator\msvs.py", line 1740, in _DictsToFolders
    for folder, contents in bucket.items():
AttributeError: 'MSVSProject' object has no attribute 'items'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\OPT\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:311:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\OPT\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\coding\fcc\node_modules\fsevents
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok

> husky@4.2.5 install D:\coding\fcc\node_modules\husky
> node husky install

husky > Setting up git hooks
husky > Done

> husky@4.2.5 postinstall D:\coding\fcc\node_modules\husky
> opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate


> core-js-pure@3.6.5 postinstall D:\coding\fcc\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> docsify@4.11.3 postinstall D:\coding\fcc\node_modules\docsify
> opencollective-postinstall

Thank you for using docsify!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/docsify/donate


> cypress@4.11.0 postinstall D:\coding\fcc\node_modules\cypress
> node index.js --exec install

Note: Skipping binary installation: Environment variable CYPRESS_INSTALL_BINARY = 0.


> @freecodecamp/freecodecamp@0.0.1 postinstall D:\coding\fcc
> npm run bootstrap

The system cannot find the path specified.

> @freecodecamp/freecodecamp@0.0.1 bootstrap D:\coding\fcc
> lerna bootstrap --ci

lerna notice cli v3.22.0
lerna info versioning independent
lerna info ci enabled
lerna info Bootstrapping 10 packages
lerna info Installing external dependencies
lerna ERR! npm ci exited 4294963245 in '@freecodecamp/curriculum'
lerna ERR! npm ci stderr:
The system cannot find the path specified.
npm WARN tarball tarball data for npm@6.14.7 (sha512-swhsdpNpyXg4GbM6LpOQ6qaloQuIKizZ+Zh6JPXJQc59ka49100Js0WvZx594iaKSoFgkFq2s8uXFHS3/Xy2WQ==) seems to be corrupted. Trying one more time.
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\fs-write-stream-atomic\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\function-bind\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\ip\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\object.getownpropertydescriptors\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\promise-retry\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\promzard\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\sorted-union-stream\node_modules\string_decoder\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\verror\.npmignore'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\is-symbol\.nvmrc'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\es-abstract\.nycrc'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\performance-now\.tm_properties'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-03\examples\calendar'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-03\examples\card'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\umask\ChangeLog'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-03\examples\geo'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-03\examples\interfaces'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-00\json-ref'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-01\json-ref'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-02\json-ref'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\json-schema\draft-03\json-ref'
npm WARN tar ENOENT: no such file or directory, open 'D:\coding\fcc\curriculum\node_modules\npm\node_modules\xtend\LICENCE'
npm ERR! code ENOTEMPTY
npm ERR! syscall rmdir
npm ERR! path D:\coding\fcc\curriculum\node_modules\npm\node_modules
npm ERR! errno -4051
npm ERR! ENOTEMPTY: directory not empty, rmdir 'D:\coding\fcc\curriculum\node_modules\npm\node_modules'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\OPT\AppData\Roaming\npm-cache\_cacache\_logs\2020-08-04T23_06_41_266Z-debug.log

lerna ERR! npm ci exited 4294963245 in '@freecodecamp/curriculum'
lerna WARN complete Waiting for 2 child processes to exit. CTRL-C to exit immediately.
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963245
npm ERR! @freecodecamp/freecodecamp@0.0.1 bootstrap: `lerna bootstrap --ci`
npm ERR! Exit status 4294963245
npm ERR!
npm ERR! Failed at the @freecodecamp/freecodecamp@0.0.1 bootstrap 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!     C:\Users\OPT\AppData\Roaming\npm-cache\_cacache\_logs\2020-08-04T23_07_30_281Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294963245
npm ERR! @freecodecamp/freecodecamp@0.0.1 postinstall: `npm run bootstrap`
npm ERR! Exit status 4294963245
npm ERR!
npm ERR! Failed at the @freecodecamp/freecodecamp@0.0.1 postinstall 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!     C:\Users\OPT\AppData\Roaming\npm-cache\_logs\2020-08-04T23_07_30_335Z-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 21 (21 by maintainers)

Most upvoted comments

OK. I guess it was a combination of errors. Once I cherry-picked the commits on #39454 into a branch off master where the changes @lasjorg suggested, everything is working again on my Windows machine.

@Twaha-Rahman Thanks for the help.

@lasjorg If you want to create a PR with your suggested bumps, I think we can get those changes merged quickly.

@Twaha-Rahman Sure. I will do that now.

@Twaha-Rahman is working on the CI here: https://github.com/freeCodeCamp/freeCodeCamp/pull/39456, but GitHub actions don’t really support Windows properly either, so it’s harder than I’d realised to put even basic checks in place.

Thanks for sticking with that @Twaha-Rahman and please let us know if we can help at all.

Let me boot up my Windows side and validate the fix works for me.

I see the same issue.

This seems to be a problem with fsevent (or packages with dependencies on it). As far as I can tell, fsevent is not supposed to build on non-Mac-OSX OSs and it was fixed in fsevent 1.2.13.

Troubleshooting dependencies and reproducing the steps is a pain in the behind, so this is just what I have found to work for me. Updating docsify-cli from 4.4.0 to 4.4.1 and running npm i jest, which doesn’t update the version but does update the dependencies in the lock file, seems to fix it for me.

fetch latest
npm run clean
npm i docsify-cli // updates it from 4.4.0 to 4.4.1
npm i jest // does not update the version number, but does update the lock file
npm ci // should finish without issues

@RandellDawson Let me know if this works for you, if so we likely just have to bump the dependencies.