I am creating an Node.js app and I need to install ejs but I am unable to install it. It is showing me the following error - node.js

node --harmony ./postinstall.js
'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN #react-navigation/core#3.7.5 requires a peer of react#* but
none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view#0.14.9 requires a peer of react#*
but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view#0.14.9 requires a peer of
react-native#* but none is installed. You must install peer
dependencies yourself.
npm WARN react-navigation#4.3.7 requires a peer of react#* but none is
installed. You must install peer dependencies yourself.
npm WARN react-navigation#4.3.7 requires a peer of react-native#* but
none is installed. You must install peer dependencies yourself.
npm WARN ashutosh#1.0.0 No description
npm WARN ashutosh#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ejs#3.1.3 postinstall: node --harmony ./postinstall.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ejs#3.1.3 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\Ashutosh\AppData\Roaming\npm-cache_logs\2020-05-22T23_26_50_117Z-debug.log

You need to have a path to NodeJS inside your environment variables list.
On some OS reboot might be needed to make this work.
Try reboot or reinstall NodeJS and then reboot.

Related

Updating Npm packages with unresolved Peer dependencies

I am trying to update react-router-dom however when I try I get an ERR of course. The error ERESOLVE unable to resolve dependency tree
npm update "popper.js" "bootstrap" "react-router-dom" :
Could not resolve dependency:
npm ERR! peer popper.js#"^1.16.1" from bootstrap#4.6.1
npm ERR! node_modules/bootstrap
npm ERR! bootstrap#"^4.1.1" from the root project
npm update popper.js :
Could not resolve dependency:
npm ERR! peer popper.js#"^1.16.1" from bootstrap#4.6.0
npm ERR! node_modules/bootstrap
npm ERR! bootstrap#"^4.1.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: popper.js#1.16.1
npm ERR! node_modules/popper.js
npm ERR! peer popper.js#"^1.16.1" from bootstrap#4.6.0
npm ERR! node_modules/bootstrap
npm ERR! bootstrap#"^4.1.1" from the root project
And it seems like Im stuck in this loop of not being able to update bootstrap because popper.js is behind and I can update popper.js because of bootstrap.
I am running npm update "popper.js" | "bootstrap" | "react-router-dom" independently.
But no matter what I do I get these same errors.
I am working inside a giant project with alot of dependencies that need updating so I cant just run an update on everything. Can someone explain how I can update the peer dependencies? Ive never done an update like this so any pointer in the right direction would be helpful.
The best option is to run script with flag --legacy-peer-deps it will skip checking peer dependency. Peer dependency should be installed manually in package.json.
Read more about the flag.

unable to start node project

D:\freelancing\FlowerAppProject\WEBAPP_10_5>npm install
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
> node#11.15.0 preinstall D:\freelancing\FlowerAppProject\WEBAPP_10_5\node_modules\node
> node installArchSpecificPackage
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/animations#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/cdk#^8.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/common#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/core#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/forms#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/material#^8.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN #angular/compiler-cli#7.2.16 requires a peer of typescript#>=3.1.1 <3.3 but none is installed. You must install peer dependencies yourself.
npm WARN #ngtools/webpack#7.3.10 requires a peer of typescript#>=2.4.0 < 3.3 but none is installed. You must install peer dependencies yourself.
npm WARN #pscoped/ngx-pub-sub#3.0.0 requires a peer of #angular/common#^8.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN #pscoped/ngx-pub-sub#3.0.0 requires a peer of #angular/core#^8.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN angular-image-slider#0.0.9 requires a peer of #angular/animations#^8.2.13 but none is installed. You must install peer dependencies yourself.
npm WARN ng-image-slider#2.5.0 requires a peer of #angular/common#^8.2.2 but none is installed. You must install peer dependencies yourself.
npm WARN ng-image-slider#2.5.0 requires a peer of #angular/core#^8.2.2 but none is installed. You must install peer dependencies yourself.
npm ERR! file bash
npm ERR! path bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bash
npm ERR! node#11.15.0 preinstall: `node installArchSpecificPackage`
npm ERR! spawn bash ENOENT
npm ERR!
npm ERR! Failed at the node#11.15.0 preinstall 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\hunter\AppData\Roaming\npm-cache\_logs\2020-05-15T13_23_06_391Z-debug.log
First - have you run npm install -g angular already?
If so -
Have you tried to manually install the missing dependencies?
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/animations#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/cdk#^8.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/common#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/core#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/forms#^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN #angular-material-extensions/password-strength#4.1.2 requires a peer of #angular/material#^8.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN #angular/compiler-cli#7.2.16 requires a peer of typescript#>=3.1.1 <3.3 but none is installed. You must install peer dependencies yourself.
npm WARN #ngtools/webpack#7.3.10 requires a peer of typescript#>=2.4.0 < 3.3 but none is installed. You must install peer dependencies yourself.
npm WARN #pscoped/ngx-pub-sub#3.0.0 requires a peer of #angular/common#^8.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN #pscoped/ngx-pub-sub#3.0.0 requires a peer of #angular/core#^8.2.11 but none is installed. You must install peer dependencies yourself.
npm WARN angular-image-slider#0.0.9 requires a peer of #angular/animations#^8.2.13 but none is installed. You must install peer dependencies yourself.
npm WARN ng-image-slider#2.5.0 requires a peer of #angular/common#^8.2.2 but none is installed. You must install peer dependencies yourself.
npm WARN ng-image-slider#2.5.0 requires a peer of #angular/core#^8.2.2 but none is installed. You must install peer dependencies yourself.
The package.json file should take care of this in theory, but obviously it is not.
You should go down the list and manually npm install #angular/animations#^8.2.14 etc until all the entries are installed successfully and try again.
For some reason on your machine it's not automatically picking up the dependencies - I assume that you installed angular already or this whole project is coming from some tutorial you're following?
These lines mean that it tries to run bash command but can not find it:
npm ERR! file bash
npm ERR! path bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bash
npm ERR! node#11.15.0 preinstall: `node installArchSpecificPackage`
npm ERR! spawn bash ENOENT
I assume that you are running it under the Windows OS, where bash is absent (if you are not running it under WSL e.g.).

NPM multiple install errors

When I try to install npm the console gives the following errors & warnings:
npm WARN checkPermissions Missing write access to C:\Users\Aristophanes\node_modules\web3
npm WARN ajv-keywords#2.1.1 requires a peer of ajv#^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#2.1.0 requires a peer of babel-eslint#^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#2.1.0 requires a peer of eslint#^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader#1.9.0 requires a peer of eslint#>=1.6.0 <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jsx-a11y#5.1.1 requires a peer of eslint#^2.10.2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
npm WARN firebase-functions#2.1.0 requires a peer of firebase-admin#~6.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path C:\Users\Aristophanes\node_modules\web3
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'C:\Users\Aristophanes\node_modules\web3'
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! C:\Users\Aristophanes\AppData\Roaming\npm-cache\_logs\2018-11-02T23_13_12_948Z-debug.log
Does anyone know how I can fix this? Thank you.
Try removing the web3 folder in C:\Users\Aristophanes\node_modules\web3, as well as the node_modules folder in your project directory (if exists). Hope it will help you :)
There are 2 solutions for this.
**1. Reinstall npm with a Node version manager (recommended).**
This is the best way to avoid permissions issues. For more information, refer this link
(https://docs.npmjs.com/getting-started/installing-node#using-a-version-manager-to-install-nodejs-and-npm)
You do not need to remove your current version of npm or Node.js before installing a Node version manager.
**2. Change npm's default directory manually.**
If you're not using windows you can use below steps.
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, it will be a hidden directory on your home folder.
Back-up your computer before you start.
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Test: Download a package globally without using sudo.
npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don't want to modify ~/.profile):
NPM_CONFIG_PREFIX=~/.npm-global

Sodium fails to install when on Raspberry Pi

When trying to install Sodium with NPM on my Raspberry Pi, the installation always fails and complains that it does not have write access to /home/Captain/node_modules/libsodium. I'm running the installation command through sudo, and the install still doesn't want to work. Did I just royally mess up my install?
$ sudo npm install sodium
npm WARN checkPermissions Missing write access to /home/Captain/node_modules/libsodium
npm WARN enoent ENOENT: no such file or directory, open '/home/Captain/package.json'
npm WARN discord.js#11.2.1 requires a peer of erlpack#hammerandchisel/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of node-opus#^0.2.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of opusscript#^0.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of libsodium-wrappers#^0.5.4 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of uws#^0.14.5 but none is installed. You must install peer dependencies yourself.
npm WARN Captain No description
npm WARN Captain No repository field.
npm WARN Captain No README data
npm WARN Captain No license field.
npm ERR! path /home/Captain/node_modules/libsodium
npm ERR! code ELOOP
npm ERR! errno -40
npm ERR! syscall access
npm ERR! ELOOP: too many symbolic links encountered, access '/home/Captain/node_modules/libsodium'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-11-21T02_23_41_242Z-debug.log
no, your setup is fine.
try this command
sudo chmod 777 /home/Captain/node_modules/libsodium
that should fix it.
EDIT: I know this is a 2 year old answer but I would like to tell people who stumble across this post to NEVER use 777! 777 allows anyone to read, write and execute your file, you SHOULD use 644 which allows anyone to read the file only while you can read and write said file.

Redux-form not getting installed & npm install not administrator errors

I am trying to install redux-form & redux-form-material-ui using npm install, but its showing you need to install peer dependencies first, which I am doing but these modules are still not available under node modules folder.
I am running 'npm install' in git bash as an administrator but its showing run as a root/administrator. However its running when I am using 'npm install -g', I am not getting the reason for this odd behavior.
However still after using -g those modules are not getting installed - Error of module not found is coming.
Environment?
Node version - 8.0.0 ( Even tried with v6) npm - 5.4.0 Redux form
-latest OS- Windows 10
Logs-
$ npm install redux-form npm ERR! path
D:\ABC\template\node_modules\fsevents\node_modules\aproba\package.json
npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm
ERR! Error: EPERM: operation not permitted, unlink
'D:\ABC\template\node_modules\fsevents\node_modules\aproba\package.json'
npm ERR! { Error: EPERM: operation not permitted, unlink
'D:\ABC\template\node_modules\fsevents\node_modules\aproba\package.json'
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink
'D:\ABC\template\node_modules\fsevents\node_modules\aproba\package.json'',
npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall:
'unlink', npm ERR! path:
'D:\ABC\template\node_modules\fsevents\node_modules\aproba\package.json'
} npm ERR! npm ERR! Please try running this command again as
root/Administrator. npm ERR! A complete log of this run can be found
in: npm ERR!
C:\Users\dbhowmick.ABC\AppData\Roaming\npm-cache_logs\2017-09-18T13_03_31_862Z-debug.log
For just 'npm install' same error is coming, even if I am running as administrator.
$ npm install -g redux-form npm WARN redux-form#7.0.4 requires a peer
of react#^15.0.0-0 || ^16.0.0-0 but none is installed. You must
install peer dependencies yourself. npm WARN redux-form#7.0.4 requires
a peer of react-redux#^4.3.0 || ^5.0.0 but none is installed. You must
install peer dependencies yourself. npm WARN redux-form#7.0.4 requires
a peer of redux#^3.0.0 but none is installed. You must install peer
dependencies yourself.
redux-form#7.0.4 added 24 packages in 14.599s Its showing added but no
folder created under node modules, & redux form module not found is
coming.
For installing redux-form-material-ui same error is coming
$ npm install -g redux-form-material-ui
npm WARN redux-form-material-ui#4.2.0 requires a peer of react#15 but none is installed. You must install peer dependencies yourself.
npm WARN redux-form-material-ui#4.2.0 requires a peer of redux-form#6 but none is installed. You must install peer dependencies yourself.
redux-form-material-ui#4.2.0
added 1 package in 1.509s
Updating the npm through command prompt(run as administrator) and then installing redux worked for me.
Update:
npm i -g npm
Install:
npm install redux --save
I also faced the same issue then I run cmd as administrator
and run yarn add react-redux and it worked for me smoothly.
I think yarn is best to use instead of npm

Resources