NPM install not work and make lock-json file - npm

Hi I'm trying to install npm to run a kit.
my node version is: v12.18.3
my npm version is: 6.14.6
my folder is "test" and I'm installing npm with this command:
Kian#DESKTOP-CL16DA7 MINGW64 /d/markitdone/test
$ npm install
npm WARN saveError ENOENT: no such file or directory, open 'D:\markitdone\test\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:\markitdone\test\package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.
up to date in 0.845s
found 0 vulnerabilities
Could someone help me please?

Before you use npm install.
You need to create a project, either React, Vue.js or Angular in your test directory

Related

What is the reason for the npm installation error ENOENT: no such file or directory, open 'C:\Users\tusha\package.json'?

I try to install libraries with npm on Windows to work with JavaScript, but it shows this error output in Windows command prompt window:
C:\Users\tusha>npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\tusha/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\tusha\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! C:\Users\tusha\AppData\Local\npm-cache\_logs\2022-04-24T10_37_38_185Z-debug-0.log
C:\Users\tusha>
Here is also a photo:
Screen shot of command prompt window with the error output
The log of the failed installation process:
The complete log file on Google Drive
ERR telling that in your folder directory you are installing some packages through npm. Look like package.json not found in located directory
Before run npm install to empty folder you have to initialize the npm init to create package.json file. and start installing packages.
npm install reads the file package.json from the current directory and installs all the packages it depends on. The error message says that there is no such file.
You need to cd to the directory the Node.js project (e.g. something you might have checked out from a Git repository) and run npm install there.
Alternatively, if you are trying to install a specific package from the npm repository then you need to:
cd to the directory containing the package you want to add it as a dependency of
run npm install name-of-package
If you don't have a project yet, and want to create one, then:
cd to the directory you want to create your package inside
npm init and follow the prompts
Alternatively, if you are trying to install a program from npm globally then reconsider as current best practice is to run program with npx and not install them as globals. Use the name of the package you want to run as an argument.
npx create-react-app
If you really want to install globally, then use the -g switch and the name of the package.
npm install -g create-react-app

NPM install only creating a package-lock.json?

I am working on a Microsoft Surface 3 running Windows 10. I use git bash for windows for file system management. I'm running npm version 6.14.4 and node version 12.16.2
I'm currently working on an app for some school work and want to run a lite-server instead of vscode's go live extension.
My understanding is that npm install should be run outside of the application as a best practice, but once it's running, you can go back in your terminal in vscode and use npm run start or npm run dev to get the server up. I learned that the two-step process from an online course where I cloned the instructor's work from his Github. In other words, he may have done some preliminary steps that I'm leaving out unintentionally.
I visited the npm docs and spend about an hour familiarizing myself with the technology. Found a nice, simple set of commands to get moving:
$ npm install lite-server --save-dev
(which I run in the project's root folder from git bash)
$ yarn add lite-server --dev # or yarn
...and add a "script" entry within your project's package.json file:
Inside package.json...
"scripts": {
"dev": "lite-server"
},
With the above script entry, you can then start lite-server via:
$ npm run dev
Problem is, I get loads of errors upon NPM install, no package.json file is generated (only a package-lock.json), and attempting npm run dev brings up multiple errors.
From NPM install, I see the following issues mostly:
I get deprecated warnings, chokidar, fsevents, urix, etc.
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents#1.2.12: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
I am always getting this package-lock.json notice, not sure what it is:
npm notice created a lockfile as package-lock.json. You should commit this file.
Obviously loads of "skipping optional dependency" warnings:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\chokidar\node_modules\fsevents):
I get "no such file or directory" warnings:
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\smansfield\desktop\bootcamp_code_responses\class_content_1\activity_4\package.json'
I get these warnings:
npm WARN activity_4 No description
npm WARN activity_4 No repository field.
npm WARN activity_4 No README data
npm WARN activity_4 No license field.
From npm run dev I'm getting these errors:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\smansfield\Desktop\bootcamp_code_responses\class_content_1\activity_4\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\smansfield\Desktop\bootcamp_code_responses\class_content_1\activity_4\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! C:\Users\smansfield\AppData\Roaming\npm-cache_logs\2020-04-26T17_59_00_317Z-debug.log
I've searched all manner of blogs for any insight on these items... No one seems to have posted about these exact items:
why NPM install is responding with so many errors, deprecation, etc.
why am I only getting package-lock.json upon install?
why am I always getting these errors when I try to spin up the lite-server, especially these ENOENT codes and path errors?
Thank you for any insight you can provide me on this. I'll most certainly pay it forward.
Sam
Try run npm init first. It will initialize your project with npm.

Can't install ESLint in project folder - npm error code ENOSELF

I'm struggling to install ESLint from my terminal (locally in my project folder).
I'm running this command:
sudo npm install eslint --save-dev
However, an npm error with code ENOSELF is returned, with the following message
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "eslint" under a package
npm ERR! also called "eslint". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! <https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/[username]/.npm/_logs/2020-01-07T14_32_27_111Z-debug.log
I have no folder nor files named eslint or anything remotely close to that. In my project directory I have a collection of html, js and csv files that have been edited with VSCode.
I'm really confused why this error is happening, and would appreciate help.
Make sure that the name property in your package.json is not eslint

New Ember.js app in shared folder of VMware Ubuntu guest

I am trying to develop an Ember.js app in VMware. The scenario is the following:
Host: Windows 7 Pro.
Guest: Ubuntu Server 18.04.
After installation of Ember.js, "ember -v" returns:
ember-cli: 3.15.1
node: 12.14.0
os: linux x64
If i try to create a new Ember app from my home directory there is no problem but, as I want to edit files from Windows host OS, when I try to do the same (ember new app_name) in the shared folder (/mnt/hgfs/folder_name/) an error is thrown:
Error creating new application. Removing generated directory `./app_name`
Command failed: npm install --loglevel error
npm WARN deprecated core-js#2.4.1: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.11: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated exists-sync#0.0.4: Please replace with usage of fs.existsSync
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /mnt/hgfs/folder_name/app_name/node_modules/.acorn-dynamic-import.DELETE/node_modules/acorn
npm ERR! dest /mnt/hgfs/folder_name/app_name/node_modules/acorn-dynamic-import/node_modules/acorn
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/mnt/hgfs/folder_name/app_name/node_modules/.acorn-dynamic-import.DELETE/node_modules/acorn' -> '/mnt/hgfs/folder_name/app_name/node_modules/acorn-dynamic-import/node_modules/acorn'
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! /home/user/.npm/_logs/2020-01-03T21_43_21_623Z-debug.log
Stack Trace and Error Report: /tmp/error.dump.1e44562d410bb23303e1023cf42f30f8.log
I tried the following solution from https://docs.npmjs.com/getting-started/fixing-npm-permissions
# 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
But no success.
Any help would be appreciated to solve this issue.

Can't uninstall a package

I'm getting this error text when attempting to uninstall tfx-cli:
C:\Users\Admin>npm uninstall tfx-cli
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Admin\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\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 0.14s
I'm trying to uninstall due to this issue, so I can attempt another reinstall.
The file C:\Users\Admin\package.json doesn't exist, but C:\Users\Admin\package-lock.json does. It contains a single line of text:
{
"lockfileVersion": 1
}
How to get past this?
npm by default looks for the package in local folder. You need to use -g option if you want to install/uninstall globally.
npm uninstall -g tfx-cli