Npm install error(fails)

Hi ,
I downloaded the mflix-js project and used npm install and it started to show errors , tried different methods like changing package.json dependencies to " * " , installing npm i node-gyp , but that also didn’t work …Please help.

npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient…
npm WARN old lockfile
npm WARN deprecated ini@1.3.5: Please update to ini >=1.3.6 to avoid a prototype pollution issue
npm WARN deprecated urix@0.1.0: Please see GitHub - lydell/urix: [DEPRECATED] Makes Windows-style paths more unix and URI friendly.
npm WARN deprecated request-promise-native@1.0.7: request-promise-native has been deprecated because it extends the now deprecated request package, see Request’s Past, Present and Future · Issue #3142 · request/request · GitHub
npm WARN deprecated har-validator@5.1.3: this library is no longer supported
npm WARN deprecated libnpmconfig@1.2.1: This module is not used anymore. npm config is parsed by npm itself and by @npmcli/config
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated resolve-url@0.2.1: GitHub - lydell/resolve-url: [DEPRECATED] Like Node.js’ `path.resolve`/`url.resolve` for the browser.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated source-map-url@0.4.0: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice · Issue #797 · debug-js/debug · GitHub)
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice · Issue #797 · debug-js/debug · GitHub)
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice · Issue #797 · debug-js/debug · GitHub)
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice · Issue #797 · debug-js/debug · GitHub)
npm WARN deprecated debug@3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (ReDos Vulnerability Regression Visibility Notice · Issue #797 · debug-js/debug · GitHub)
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated samsam@1.3.0: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated babel-eslint@9.0.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated uuid@3.3.3: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See There’s Math.random(), and then there’s Math.random() · V8 for details.
npm WARN deprecated request@2.88.0: request has been deprecated, see Request’s Past, Present and Future · Issue #3142 · request/request · GitHub
npm WARN deprecated source-map-resolve@0.5.2: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated bson@1.1.1: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see CVE - CVE-2019-2391 for more details
npm WARN deprecated core-js@2.6.9: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@3.2.1: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path D:\Web Development Angels\MongoDb Course\M220\mflix-js\node_modules\weak-napi
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.4.1
npm ERR! gyp info using node@16.14.2 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at “C:\Users\Home\AppData\Local\Programs\Python\Python39\python.exe”
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with ‘–loglevel silly’ for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the “Desktop development with C++” workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS GitHub - nodejs/node-gyp: Node.js native addon build tool
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
npm ERR! gyp ERR! stack at C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:384:16
npm ERR! gyp ERR! stack at C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:526:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! gyp ERR! command “D:\VS Code\node\node.exe” “C:\Users\Home\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js” “rebuild”
npm ERR! gyp ERR! cwd D:\Web Development Angels\MongoDb Course\M220\mflix-js\node_modules\weak-napi
npm ERR! gyp ERR! node -v v16.14.2
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Home\AppData\Local\npm-cache_logs\2022-05-12T10_12_43_384Z-debug-0.log

Thank you.(●’◡’●)

1 Like

Hi @Ravi_Pathak, welcome to the community.
Can you please delete the package-lock.json file and node_modules folder?
Once done, please run:

npm install

from the root directory of the project folder.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

Hi @SourabhBagrecha, actually I’m facing same issue, tried all possible cases but node_modules ain’t getting installed :smiling_face_with_tear:

Hi @SourabhBagrecha sir , i tried deleting package-lock.json file , but it still showed error (plus when trying to use npm install it loads the node_modules folder but after error it deletes itself), what else could i try?

Hi @Shubham_Jadhav & @Ravi_Pathak, are you facing the same error as mentioned in the original post after you delete the package-lock.json file, or is it something else?

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

@SourabhBagrecha YES! same error

node_modules ain’t getting installed
tried deleting package-lock.json & run npm install, then few of packages get broken & app doesn’t work!

do you have an idea about this error?

@SourabhBagrecha sir , after deleting the pacakage-lock.json, i got this error and still the node modules folder deleted itself.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: server@1.0.0
npm ERR! Found: babel-eslint@9.0.0
npm ERR! node_modules/babel-eslint
npm ERR! babel-eslint@"^9.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer babel-eslint@"^7.2.3" from eslint-config-react-app@2.1.0
npm ERR! node_modules/eslint-config-react-app
npm ERR! eslint-config-react-app@"^2.1.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\Home\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Home\AppData\Local\npm-cache_logs\2022-05-20T11_43_25_236Z-debug-0.log
PS D:\Web Development Angels\MongoDb Course\M220\mflix-js2>

1 Like

Thank you everyone i have got the project running (it’s working on local host 5000)

used these methods to update and install dependencies

$ npx npm-check-updates -u
$ npm install 

But the first test “npm test -t db-connection” is falling don’t know why?
(where as its getting connected by compass)
What could be done to stop this error.

the fail log :

server@1.0.0 test
jest --passWithNoTests “db-connection”

Determining test suites to run…Setup Mongo Connection
FAIL test/db-connection.test.js
● Test suite failed to run

TypeError: Super expression must either be null or a function



  at _inherits (node_modules/@babel/runtime/helpers/inherits.js:5:11)
  at test/config/mongoEnvironment.js:30:29
  at Object.<anonymous> (test/config/mongoEnvironment.js:116:2)
  at Module._compile (node_modules/pirates/lib/index.js:136:24)
  at Object.newLoader (node_modules/pirates/lib/index.js:141:7)

Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.466 s
Ran all test suites matching /db-connection/i.
Teardown Mongo Connection

Hello @SourabhBagrecha, I hope your day is going well!

Unfortunately, this error is still occurring.
I attempted fixing it using the recommended solution:

rm package-lock.json
npm install

But encountered the exact same Peer Dependency error as @Ravi_Pathak.

I attempted another solution that you suggested in a different thread, and after running npm update -g npm I encountered this error:

3 vulnerabilities (1 moderate, 1 high, 1 critical)

I ran npm audit fix --force until errors subsided, then ran npm install --force.

However, when attempting to run the test npm test -t db-connection, the following error occurs:

 FAIL  test/db-connection.test.js
  ● Test suite failed to run

    TypeError: Class constructor NodeEnvironment cannot be invoked without 'new'



      at new MongoEnvironment (test/config/mongoEnvironment.js:30:113)
      at async TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:317:13)
      at async runJest (node_modules/@jest/core/build/runJest.js:407:19)
      at async _run10000 (node_modules/@jest/core/build/cli/index.js:338:7)
      at async runCLI (node_modules/@jest/core/build/cli/index.js:190:3)

I found another thread (Post Title: Running NPM install will fails (can’t link, exhausted max amount of links (2) as a new user) from a couple weeks ago confirming that the npm install errors are due to the M220JS Project expecting an older version of Node.js.

I’d really prefer not having to roll back my Node.js version, so I attempted this solution from a different thread:

rm package-lock.json
npm install --legacy-peer-deps

After running npm audit fix --force again afterwards, I was finally able to get the test suite working.

Thank you @SourabhBagrecha and everyone for all of your help! I really appreciate it.

1 Like

Hi @trainingmode , Thanks for the help …
The solution given by you is working , i tried making a new mflix project with your methods (it showed 5 moderate vulnerability ) , but its working now, plus the test cases are also working …

thanks for the help.:heart::grin:

1 Like