Why am I getting an error when trying to install and run npm? - node.js

I am trying to install and run npm in a linux environment. I have executed the below code to try and achieve this
nvm install v11.0.0
nvm use v11.0.0
npm install
npm start
When I execute npm install in the command line I keep getting the following error message. Any advice to help this run is much appreciated.
npm WARN saveError ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm WARN pythonProject No description
npm WARN pythonProject No repository field.
npm WARN pythonProject No README data
npm WARN pythonProject No license field.

npm install is looking for package.json in order to see what it needs to do. Since you dont have it - you get the errors.
See https://docs.npmjs.com/cli/v7/commands/npm-install

Before running npm install, create an npm project.
This can be done with npm init -y
Now you can use npm install <package name>

Related

i have error install angular and npm package

I delete the old version of angular and trying to install a new one after update Nodejs and get this error
this error appears when trying to install angular
i trying to resolve by this steps and get different error
1) npm cache verify (If not running, add --force)
2) npm uninstall -g #angular/cli
3) check node --version and ng --version
4) npm i -g #angular/cli#latest
5) npm install --save-dev #angular/cli#latest
5) Delete node_modules and run npm install
6) Kill all instances of terminal
error :
admins-MacBook-Pro:~ admin$ sudo npm i -g #angular/cli#latest
npm ERR! path /usr/local/bin/ng
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/bin
npm ERR! File exists: /usr/local/bin/ng
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/admin/.npm/_logs/2019-08-01T03_26_03_978Z-debug.log
admins-MacBook-Pro:~ admin$ npm install
npm WARN saveError ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN admin No description
npm WARN admin No repository field.
npm WARN admin No README data
npm WARN admin No license field.
up to date in 1.274s
found 0 vulnerabilities
admins-MacBook-Pro:~ admin$ sudo npm install
npm WARN saveError ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN admin No description
npm WARN admin No repository field.
npm WARN admin No README data
npm WARN admin No license field.
up to date in 1.199s
found 0 vulnerabilities
Try:-
Add sudo if on Mac.
As of npm#5, the npm cache self-heals from corruption issues and data
extracted from the cache is guaranteed to be valid. If you want to
make sure everything is consistent, use 'npm cache verify' instead. If
you're sure you want to delete the entire cache, rerun this command
with --force.
Delete current project and create one new:-
A) ng new PROJECTNAME
then,
1) npm cache verify (If not running, add --force)
2) npm uninstall -g #angular/cli
3) check node --version and ng --version
4) npm i -g #angular/cli#latest
5) npm install --save-dev #angular/cli#latest
6) Delete node_modules and run npm install
7) Destroy all instances of terminal.
and,
Delete package.lock.json.
Create package.json by running `npm init`, then follow step 6
If your project is opened, then try closing vscode or whatever code editor and then try installing again.

Error Message is popping in cmd while installing appium through npm in windows 10

I try to install appium with npm on Windows 10 CMD but I get the following error messages:
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\sample1.bplist'
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\sample2.bplist'
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\uid.bplist'
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\utf16.bplist'
npm ERR! Maximum call stack size exceeded
Looks like you are missing some packages.
Make sure that your package.json has listed all your dependencies
Run npm install
If the issues still persists
Run npm install
Run npm cache clean
Run npm install -g npm
Rub npm install again
You can resolve that issue by following methods:
Just type npm install and hit Enter.
Check issue still exists. and If issue not resolved, continue these methods.
type npm cache clean and hit Enter
type sudo npm install -g npm and hit Enter.
Retry npm install and hit Enter.
If you are behind the company network proxy you can execute the following command on CMD:
npm config set https-proxy http://proxyip:port/

npm install from tgz created with npm pack

I've created a .tgz file with npm pack. When trying to install it npm prints out the following error:
D:\tmp>npm install package-0.0.1.tgz
npm WARN saveError ENOENT: no such file or directory, open 'D:\tmp\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'D:\tmp\package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.
It looks like npm for some reason does not extract the contents of my .tgz package, meaning all the .js files, package.json etc. although everything is there. Apparently it only tries to install the dependencies listed in my package.
Should it really work this way or I'm doing something wrong?
This error means you are not in a directory that has a package.json file and you are using the command that installs a package as a dependency into an existing, (local) npm project's package.json.
To install your package globally (just to test if it can be installed):
npm install -g package-0.0.1.tgz
Or, if you want to install/add it as a dependency to some other npm project (like a test harness), first make sure that npm project has a package.json, and then :
test-harness-dir> npm install package-0.0.1.tgz

npm ERR! Refusing to delete / code EEXIST

I'm just running a simple npm install and i get this error.
npm ERR! path /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which
npm ERR! code EEXIST
npm ERR! Refusing to delete /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which: is outside /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/which and not a link
npm ERR! File exists: /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which
npm ERR! Move it away, and try again
This is the first time I get this error and I don't know what to do.
Steps
Delete the node_modules directory completely.
Run npm install again.
This should help.
This was how I solved mine after 'googling' around...
Navigate to the directory your node was installed in
rename your npm.cmd and npm files
Try run the installation again
If successful..delete the files you renamed earlier npm and npm.cmd
if not, :( :(
The cli commands here...in case you don't want to be renaming and stuffs
cd %ProgramFiles%\nodejs
ren npm.cmd npm2.cmd
ren npm npm2
npm2 install npm#latest -g
del npm2
del npm2.cmd
Rolf-schmidiger
Try running npm update -g npm then run npm i again.
If that doesn't work maybe npm cache clean helps.
If that doesn't work either you should consider removing the node_modules folder in your application and running npm i again.
If you still have no luck, I suggest removing the package-lock.json and the node_modules folder before running npm i.
For windows users (specific to windows 10) this must solve the problem.
Goto this folder:
C:\Users\[UserName]\AppData\Roaming\
delete or rename the npm and npm-cache folders.
This has fixed my problem in Windows.
I got this problem on Linux (npm is the current latest 5.6.0), because I created a tgz archive, and I needed to --dereference some symlinks (see man tar) when creating a tgz archive (which was them copied to VM for testing). This way a lot of symlinks in node_modules/.bin also became regular files.
npm says in the error message, .e.g.
npm ERR! Refusing to delete /path/to/node_modules/.bin/jest: is outside /path/to/node_modules/jest and not a link
This worked for me
npm install -g --force gatsby-cli
Thanks
I had a similar issue but was because initially the project was installed with
yarn install
Then when I tried to install dependencies using
npm install
I caught this same error. So ensure to use only one: yarn or npm. I fixed it by adding my dependency with
yarn add <vendor_name>
but the same works if you use npm instead, you need to add a dependency.
Uninstall node.js from control panel
Delete below folders
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
C:\Users\{User}\AppData\Local\Temp\npm-*
Install node.js again
I had a similar error(mine is not #angular),
resolved by deleting and reinstalling node with installer.
I had the same problem and it turned out the problem was that a stray instance of npm was running somewhere in the background at the same time I was trying to do the install (it was Webpack's npm run serve, to be precise).
Stopping the running instance resolved the problem.
I had a similar problem and what seems to have worked is to uninstall npm and reinstall it, making sure to be logged in as the correct user for the reinstall. I think I previously installed npm as root, but was updating a package as a regular (sudo) user.
I had this problem when working on a virtual, encrypted disk.
Moving the project to a regular disk solved the problem.
I the same error but when I was trying to update module "cordova" to version 9. I fixed it by forcing the install with --force. The npm command I used:
npm i -g --force cordova#9
I downgraded my node version to 10 with nvm, and it installed a newer version of npm (v6) during the process. After that, the package was installed w/o errors. So it's either npm or node version.
In my case, when trying to install for example the program mermaid-cli, and with npm being already installed,
npm install #mermaid-js/mermaid-cli
threw the error in question.
When I added --force, the output was just shortened, but the same error:
$ sudo npm install #mermaid-js/mermaid-cli --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN enoent ENOENT: no such file or directory, open '/home/MY_USER/package.json'
npm WARN MY_USER No description
npm WARN MY_USER No repository field.
npm WARN MY_USER No README data
npm WARN MY_USER No license field.
npm ERR! code EEXIST
npm ERR! path /home/MY_USER/node_modules/npm/node_modules/.bin/rimraf
npm ERR! Refusing to delete /home/MY_USER/node_modules/npm/node_modules/.bin/rimraf: is outside /home/MY_USER/node_modules/npm/node_modules/rimraf and not a link
npm ERR! File exists: /home/MY_USER/node_modules/npm/node_modules/.bin/rimraf
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-03T13_41_52_634Z-debug.log
I then followed the accepted answer that says that you only need to remove and install npm again and therefore removed the directory node_modules from my home directory where it was installed.
Yet, I still ran into the error when running npm install:
$npm install
npm WARN saveError ENOENT: no such file or directory, open '/home/MY_USER/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/MY_USER/package.json'
npm WARN MY_USER No description
npm WARN MY_USER No repository field.
npm WARN MY_USER No README data
npm WARN MY_USER No license field.
up to date in 0.865s
found 0 vulnerabilities
The easy fix for this was to just install the program with npm again when npm 'node_modules are removed! I happened to find out about by entering the command although npm's node_modules were removed. Ran through.
Logs:
$npm install #mermaid-js/mermaid-cli
> puppeteer#13.1.3 install /home/MY_USER/node_modules/puppeteer
> node install.js
Downloading Chromium r950341 - 142 Mb [====================] 100% 0.0s
Chromium (950341) downloaded to /home/MY_USER/node_modules/puppeteer/.local-chromium/linux-950341
npm WARN saveError ENOENT: no such file or directory, open '/home/MY_USER/package.json'
npm WARN notsup Unsupported engine for commander#8.3.0: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: commander#8.3.0
...
npm WARN MY_USER No description
npm WARN MY_USER No repository field.
npm WARN MY_USER No README data
npm WARN MY_USER No license field.
+ #mermaid-js/mermaid-cli#8.13.10
added 147 packages from 94 contributors and audited 147 packages in 26.338s
10 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Wrap up:
If npm install fails, install whatever program you like or dislike, but install one program with the npm command even if you just have removed npm's node_modules directory. It will download the node_modules again and in my case, the program worked.

How to fix the "npm install error" when installing "Botkit"?

I am a newbie machine learning programmer trying get how to install the botkit tool for creating AI messaging bots from the bot kit studio.
Botkit was installed but the following errors are shown in my terminal:
Rakeshs-MacBook-Air:~ niharika$ npm install
npm WARN enoent ENOENT: no such file or directory, open '/Users/niharika/package.json'
npm WARN niharika No description
npm WARN niharika No repository field.
npm WARN niharika No README data
npm WARN niharika No license field.
Rakeshs-MacBook-Air:~ niharika$ npm install --productions
npm WARN enoent ENOENT: no such file or directory, open '/Users/niharika/package.json'
npm WARN niharika No description
npm WARN niharika No repository field.
npm WARN niharika No README data
npm WARN niharika No license field.
I can't seem to figure out what the package.json file is supposed to be in order to run botkit studio.
This error does not have much to do with Botkit, but more to do with where you are running the npm install. You are running it in your /Users/niharika path. If you cloned down botkit into that directory then you will need to cd into it first. Your path will look more like /Users/niharika/botkitslackstarter/. Then run npm install which will look for a package.json in the root and install all dependencies so then you will be able to run node bot.js to start the application. Best of luck.
Step 1:
npm install
Step 2:
npm install botkit

Resources