Skip to content

gyp Errors

So, students are doing their first assignment for the term. They have to get the backend server running. The code is all provided, so it should just be a matter of running npm install to kick things off.

But, they get hit with an error, and it’s miles long in its description.

Lines removed for brevity
PS C:\GH\2008\asgn-1\backend> npm install
npm warn deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm warn cleanup Failed to remove some directories [
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\GH\\2008\\asgn-1\\backend\\node_modules',
....
npm error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\GH\\2008\\asgn-1\\backend\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\GH\2008\asgn-1\backend\node_modules\sqlite3
npm error gyp ERR! node -v v22.19.0
npm error gyp ERR! node-gyp -v v8.4.1
npm error gyp ERR! not ok
...

The clue to this error is in the parts near the end, with the lines that start with npm error gyp ERR!. It turns out that node-gyp (“gyp” stands for “generate your project”) is having trouble (for whatever internal reason). Fortunately, the fix is really easy.

Simply run the following in the terminal:

Terminal window
npm update

Now, when you try npm install once again, everything should run smooth. Whew!