npm install error: cannot find module 'read-package-tree' - node.js

executing the npm install command in windows 10 machine .
facing the below issue
C:\ >npm install
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'read-package-tree'
npm ERR! Require stack:
npm ERR! - C:\Users\dineshkumars2\AppData\Roaming\npm\node_modules\npm\lib\install.js
npm ERR! - C:\Users\dineshkumars2\AppData\Roaming\npm\node_modules\npm\lib\npm.js
npm ERR! - C:\Users\dineshkumars2\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dineshkumars2\AppData\Roaming\npm-cache\_logs\2020-12-31T02_21_08_042Z-debug.log

Try installing read-package-tree using npm command as,
npm i read-package-tree
In case same error showing for executing the above command, Please copy the folder from another machine and paste it into the path that where node_modules are in.
Ex:
C:\Users\MyName\AppData\Roaming\npm\node_modules\npm\node_modules
then run the below command npm i read-package-tree it will resolve the issue, now we can able to run the command 'npm install'

Related

NextJS not running on MacOS even after installing modules

So I've just created a NextJS project using create-next-app which went smoothly as expected. Then ran npm i just to be sure and saw all modules installed into node_modules
When I try to run npm run dev to start my nextjs app. it just says
sh: next: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test#0.1.0 dev: `next dev`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test#0.1.0 dev 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! /Users/john.v.n.pakson/.npm/_logs/2022-10-06T08_01_29_725Z-debug.log
It seems like npm is not detecting the node_modules i have installed.
Not sure if this is a mac or a zsh issue.
I'm using node version 12.22.12
Upgraded to 16.17.1 and still see the same error
> test#0.1.0 dev
> next dev
/var/folders/6y/xtlzp4z16dj0stxnqx8znj8w0000gn/T/dev-01c08137.sh: line 1: next: command not found
Okay I figured it out. It was caused by my file path on macos. My project was on a folder called Project/Test which might have confused zsh or mac. This in turn caused npm to not be able to find the correct scripts on my node_modules
When I moved my project to another folder I was already able to run npm run dev properly.
Cheers!

how to fix npm error in Mac in visual studio code

How do I fix this error?
USER#Bahus-MacBook-Air metaplex-master % npm --version
8\.5.2
USER#Bahus-MacBook-Air metaplex-master % npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/USER/Desktop/solana devnet/metaplex-master/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/USER/Desktop/solana devnet/metaplex-master/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/USER/.npm/\_logs/2022-03-24T13_07_17_630Z-debug-0.log
How do I fix this npm installation error in visual studio code in Mac?
The error message says that the path where you are executing npm i command doesn't have package.json file.
Make sure to change the path to the place where the package.json file is located.
I'm assuming you are trying this project https://github.com/metaplex-foundation/metaplex
And you are probably running npm install in the main directory. But if you read the instalation documentation which you definitely should, then you would see cd metaplex/js which means you need to run npm install within the ./js folder since that's where the package.json is, which is required by npm install command.

Cannot find module 'util.js' after command npm init on Windows 10

I installed npm before and work with many projects along with express.js , but today I opened a folder and willing to start a new project. But after npm init command , it says util.js module not found.
I found this util.js file on this root directory npm\node_modules\npm\node_modules.
How to solve this issue?
F:\Pulok\HabluTheGreatDoc\Projects\ReactApp\event-booking>npm init
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './util.js'
npm ERR! Require stack:
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\node_modules\libnpx\index.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\lib\init.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\lib\npm.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sabbir\AppData\Roaming\npm-cache\_logs\2020-07-12T06_33_44_670Z-debug.log
Edit:
npm version: 6.14.5.
node.js version: v12.16.1
I have also tried running npm cache clean --force and npm init --yes, however I continue to get the same error message.

opencv4nodejs installation issue

I am Facing trouble in installing opencv4nodejs in windows, i am getting following error.
opencv-build#0.0.15 install C:\Users\Mypc\AppData\Roaming\npm\node_modules\opencv4nodejs\node_modules\opencv-build
node ./install.js
info install if you want to use an own OpenCV installation set OPENCV4NODEJS_DISABLE_AUTOBUILD
info install library dir does not exist: C:\Users\Mypc\AppData\Roaming\npm\node_modules\opencv4nodejs\node_modules\opencv-build\opencv\build\lib\Release
info install running install script...
ERR! Error: Command failed: git --version
'git' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build#0.0.15 install: node ./install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv-build#0.0.15 install 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:
Git was not installed in windows, that was the issue. it's working perfectly now.
Git needs to be installed, it will solve this problem

npm i Running command - failed! (exit code 254)

Ionic :3.20.0
node: v8.10.0
npm: 5.6.0
npm i
✖ Running command - failed!
[ERROR] An error occurred while running npm i (exit code 254):
npm ERR! path
/Users/lucaszimmermann/Desktop/myApp/node_modules/tsickle/src/main.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod
'/Users/lucaszimmermann/Desktop/myApp/node_modules/tsickle/src/main.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR!
/Users/lucaszimmermann/.npm/_logs/2018-04-04T16_41_39_270Z-debug.log
I faced a similar issue after doing the below actions this issue solved.
Delete package-lock.json file.
Open cmd/terminal in administrator mode.
run command: npm install
run command: npm update
Node version is likely incompatible. There'd be an expected version actual version. Use nvm or similar to install and change node versions.
Delete node_modules and try install again. You probably get a message similar to:
error ts-jest#26.1.2: The engine "node" is incompatible with this module. Expected version ">= 10.21.0". Got "10.20.1"
error Found incompatible module.
You wan't try to install npm packages.
You have two options to install some packages:
First Option:
npm install <package>
npm i <package>
Second Option:
If you wan't to create an automated installation process without each package, you must provide an packge.json - Here are all depencies listed. You can only run npm i or npm install without an package name, if you have an package.json
A full documentation about that is on NPM: https://docs.npmjs.com/files/package.json

Resources