I am trying to support the how to crack a interview repository
I am trying to crack the interviews for JS position
They are using mocha and chai, so I am trying to commit the code in
JS
I am trying to execute the below steps but I am failing at the below
step, npm install
git clone https://github.com/gaylemcd/ctci.git
cd ctci/javascript
npm install
npm install -g mocha
mocha --recursive
I am getting the below error
I have installed Node.js after that tried npm install in ctci folder of javascript
providing you the link for screensshot to show where node is
installed and where I kept ctci
https://drive.google.com/file/d/0B3IBJKENGE7RMGlUYWZUa2lZY3c/view?usp=sharing
anis-MacBook-Pro:javascript Raj$ npm install
npm WARN package.json CrackingJS#0.0.1 No repository field.
That is a warning, not an error. It is simply pointing out that the package.json does not contain a "repository" field, which is a recommended field to have for convenience. You can safely ignore most warnings, especially ones like this one.
Related
I have been trying to install some packages and libraries like react-dom and react-icons but I have not been able to get any luck.
Every time I run an npm install command such as:
npm install react-icons --save
or:
npm install react react-dom
All I get is a blank line in terminal and my install doesn't go through.
This is irregardless of whether I add --save or not.
It is also irregardless of whether I use something like an integrated terminal in VS Code or my native terminal application.
npm start works and such so I'm thinking its just my install command that is failing.
It might be the case npm is not istalled? Do you have Node.js installed? NPM is included with Node.js installation. In order to check open your terminal and type npm -v. If it's installed you are going to see something like v8.10.0.
today i was trying to install my package in visual studio. But there is an error:
enter image description here
npm i
npm ERR! could not detect node name from path or package
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\holan\AppData\Local\npm-cache_logs\2021-09-01T00_08_12_922Z-debug.log
I reinstall node.js and python
here is my path
enter image description here
sorry for my bad english but i need help
As OP didn't provide details of the issue and seems to be new to nodejs, hereby explaining how npm i work in general matter.
There are main usage of npm i:
To install a package that haven't install in this project(or global) before, you can put that package name after the npm i , such as npm i express. Once the installation is done, it will insert the package name into package.json and the package source code in node_modules. You can think package.json is like a index and node_modules is the actual packages source code.
To install a package that listed in package.json. If you are copying/clone the project from other source , usually it has package.json but not the node_modules. In that case, you can use npm i to install all the packages that listed in package.json and it will then create the node_modules.
Using npm i without package.json will not install anything as there isn't a package name in the npm i [package name] and package.json .
I am using Node version 14.15.5 and npm version 6.14.11. Also, I am working on VS Code.
I have tried to install two packages by these commands:
npm install express
npm install lodash
In the end, I am not getting any of them successfully.
I received this message:
36 packages are looking for funding
run `npm fund` for details.
How to resolve this issue?
enter image description here
The reason is described here:
Before installing a package into the local folder, NPM tries to find the root of your package. To do this it walks from your current directory (C:\Users\JD Mughal\Desktop\Web\Node\test-calculator) up the hierarchy until it finds a package.json file.
Only if no package.json file is found will NPM install the new package in the current directory (respectively in a node_modules\package_name subdirectory).
In your case however NPM finds a package.json file C:\Users\JD Mughal\package.json and installs the new package there.
To resolve the use you must execute npm init in your local directory.
Installing packages for tooling via yarn.
An unhandled exception occurred: 'yarn' is not recognized as an internal or external command,
operable program or batch file.
Package install failed, see above.
See "C:\Users\hp\AppData\Local\Temp\ng-TAwQZJ\angular-errors.log" for further details.
This is the error in my terminal everytime I try to install any package.
I have tried "npm uninstall -g yarn" nothing happens. I tried in control panel to find any yarn package but nothing.
How can we do this and install packages via npm?
try either of
ng config --global cli.packageManager npm
or
ng set --global packageManager=npm
Also, Yarn is faster and better as per some blogs,
So you can keep yarn as default package manager and install it
https://classic.yarnpkg.com/en/docs/install/
I am trying to create a new react-app and start it, I have created react apps before with no errors but this time when i npm start i get this error
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix
locally.
The react-scripts package provided by Create React App requires a
dependency:
"webpack-dev-server": "3.1.14"
Don't try to install it manually: your package manager does it
automatically.
However, a different version of webpack-dev-server was detected higher up
in the tree:
C:\Users\ashraf\node_modules\webpack-dev-server (version: 3.1.9)
Manually installing incompatible versions is known to cause hard-to-debug
issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to
an .env file in your project.
That will permanently disable this message but you might encounter other
issues.
To fix the dependency tree, try following the steps below in the exact
order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your
project folder.
2. Delete node_modules in your project folder.
3. Remove "webpack-dev-server" from dependencies and/or devDependencies in
the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the
above steps with it instead.
This may help because npm has known issues with package hoisting which may
get resolved in future versions.
6. Check if C:\Users\ashraf\node_modules\webpack-dev-server is outside
your project directory.
For example, you might have accidentally installed something in your home
folder.
7. Try running npm ls webpack-dev-server in your project folder.
This will tell you which other package (apart from the expected react-
scripts) installed webpack-dev-server.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in
your project.
That would permanently disable this preflight check in case you want to
proceed anyway.
P.S. We know this message is long but please read the steps above :-) We
hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! learnreact#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the learnreact#0.1.0 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:
npm ERR! C:\Users\ashraf\AppData\Roaming\npm-cache\_logs\2019-02-
04T20_36_39_924Z-debug.log
PS C:\Users\ashraf\Desktop\Files\LearnReact\learnreact>
i have tried all the steps in detail in the error log but its still not working, any thoughts on what is causing this error? Thanks in advance
It seems like you want to depend on webpack-dev-server inside your local project.
Perhaps you need to run npm install in your project, instead of your ~ home directory?
from your output, notice these lines.
However, a different version of webpack-dev-server was detected higher up
in the tree:
C:\Users\ashraf\node_modules\webpack-dev-server (version: 3.1.9)
...
6. Check if C:\Users\ashraf\node_modules\webpack-dev-server is outside
your project directory.
For example, you might have accidentally installed something in your home
folder.
so I would
cd ./my-project
npm i
Did you install webpack-dev-server on its own? It seems it has been installed either by you or by another project install. Webpack is for your local development environment so the other install is close enough to your project to interfere with the copy that react is trying to install in your project folder. Steps 1-4 in your error message should resolve your issue. If you have done that and its still not working, did you get different error messages with your next attempt to install your react package?
I have faced the same issue and this method worked for me.
Do follow the steps:
Start terminal from the desktop and write this command:
npm uninstall webpack-dev-server
This will uninstall webpack-dev-server package globally from you node modules.
Go back to you the terminal of your project and install webpack-dev-server package:
npm install webpack-dev-server#version
Note: The version part (above) should equal the versions asked for in the error message.
npm install webpack-dev-server
Now start npm:
npm start
This error mostly occurs when you have created your project using the
npx create-react-app command instead of the npm create-react-app command.