NPM install throws module not found error - node.js

I tried installing node modules by npm install
on a new repository but the following error is shown
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './git-host-info.js'

Perhaps bin or main points to a missing file in package.json?

Related

Installing dependencies with npm-peer-dependencies

I am trying to install the required node_modules for a small project running Angular 11 using npm install
My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI.
After running the install command I tried npm start.
I was expecting that after running the install and start command to be able to run the project locally.
However the actual result I get after running the install command is the following list of errors:
> ng serve
An unhandled exception occurred: Cannot find module '#angular/compiler'
Require stack:
\node_modules\#angular\compiler-cli\index.js
\node_modules\#ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\#ngtools\webpack\src\index.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\#angular-devkit\build-angular\src\browser\index.js
\node_modules\#angular-devkit\build-angular\src\dev-server\index.js
\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\#angular-devkit\architect\node\index.js
\node_modules\#angular\cli\models\architect-command.js
\node_modules\#angular\cli\commands\serve-impl.js
\node_modules\#angular-devkit\schematics\tools\export-ref.js
\node_modules\#angular-devkit\schematics\tools\index.js
\node_modules\#angular\cli\utilities\json-schema.js
\node_modules\#angular\cli\models\command-runner.js
\node_modules\#angular\cli\lib\cli\index.js
\node_modules\#angular\cli\lib\init.js
\node_modules\#angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #0.0.16 start 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:
The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies.
What should I do next to get this Angular project installed locally ?
The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine.
The steps that you should take are to make sure of them are globally installed.
To install packages globally you need run npm install -g <package_name>
npm docs link
In your case for angular cli you should run
npm i -g #angular/cli#11.2.15 and npm install -g npm-peer-dependencies.
Then run npm start.

npm install legacy React with semantic-ui and Gulp

I am trying to install a React legacy project, but I have an error. The project is using semantic-ui 2.2.13, that is the library that seems to have the problem.
When I do npm install --legacy-peer-deps, this message appears:
npm ERR! code 1
npm ERR! path c:\src\project\node_modules\semantic-ui
npm ERR! command failed
npm ERR! command c:\WINDOWS\system32\cmd.exe /d /s /c gulp installfs.js:47
npm ERR! } = primordials;
....
npm ERR! ReferenceError: primordials is not defined
npm ERR! at fs.js:47:5
...
In the detailed log this message apperas
verbose pkgid semantic-ui#2.4.2 (instead of version 2.2.13)
I have node v16.6.1, npm 7.20.3 and in package.json react ^16.13.0, webpack ^4.23.1 among others
Could you please bring me some light about this?
In summary, your are getting the error because semantic-ui uses Gulp 4, which is not compatible with Node 12 and above. This answer suggests overriding the sub-dependency causing the error.
You may follow the issue in the official semantic-ui repo here
This article also details how to resolve this error.

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

Cannot find module 'normalize-package-data'

When I am trying to install npm,
I'm getting this error.
Description in Command prompt
Your environment has been set up for using Node.js 8.9.1 (x64) and
npm.
D:\Project\angular\mCart>npm install npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'normalize-package-data'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\chaman.mandal\AppData\Roaming\npm-cache_logs\2017-11-22T0
5_18_52_300Z-debug.log
mCart is my project directory.
I am unable to find any solution related to normalize-package-data.
Is there anyway to install it manually?
Thanks.

npm install error web project

When I try install npm modules I see the following problem:
PS C:\Users\maxzag\Desktop\svoi> npm install
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\maxzag\AppData\Roaming\npm-cache\_logs\2017-08-15T11_25_41_473Z-debug.log
Can someone already come across this problem and can something advise?
This might be your issue: https://github.com/npm/npm/issues/17858
Try removing node_modules and running npm install again.

Resources