facing issues whille installing npm ts loader and npm css loader - node.js

I am getting all these warning while installing ts loader and css loader..
npm ts loader
user#user-ThinkPad-T420s:~$ npm install --save-dev ts-loader
npm WARN saveError ENOENT: no such file or directory, open '/home/user/package.json'
/home/user
`-- ts-loader#2.1.0
npm WARN enoent ENOENT: no such file or directory, open '/home/user/package.json'
npm WARN user No description
npm WARN user No repository field.
npm WARN user No README data
npm WARN user No license field.
npm css loader
user#user-ThinkPad-T420s:~$ npm install --save-dev css-loader
npm WARN saveError ENOENT: no such file or directory, open '/home/user/package.json'
/home/user
`-- css-loader#0.28.2
npm WARN enoent ENOENT: no such file or directory, open '/home/user/package.json'
npm WARN user No description
npm WARN user No repository field.
npm WARN user No README data
npm WARN user No license field.
can anyone tell me how i can fix this ?

This is happening because you pass --save-dev parameter to npm when you install ts-loader and css-loader modules in a directory with no package.json in it.
If this is a new project, I suggest you to start by npm init, as it will create you a fresh package.json file for your project.
You can always install dependency globally if you needed it for more than one project:
npm install -g ts-loader css-loader
Others alert are not very important, but you can add a licence and a README file to get rid of it if you care.

Related

npm install not working: "npm ERR! code ERR_SSL_WRONG_VERSION_NUMBER"

I can't install modules for my react app, when i run npm i it does this:
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion#1, but package-lock.json was generated for lockfileVersion#2. I'll try to do my best with it!
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\package.json'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\index.d.ts'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\index.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\LICENSE'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\rc-5aecd98b\test\ini.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\setprototypeof-b857a2ac\README.md'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\rc-5aecd98b\test\nested-env-vars.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\rc-5aecd98b\test\test.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\term-size-f230f088\vendor\windows\term-size.exe'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\ast-types-5383d6cc\def\type-annotations.js'
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\marco\Code\backend\node_modules\.staging\ast-types-5383d6cc\def\typescript.js'
npm WARN backend#1.0.0 No description
npm WARN backend#1.0.0 No repository field.
npm ERR! code ERR_SSL_WRONG_VERSION_NUMBER
npm ERR! errno ERR_SSL_WRONG_VERSION_NUMBER
npm ERR! request to https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz failed, reason: 4376:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:308:
npm ERR!
I tried reinstalling npm and it does the same thing. I tried with another project and I'm getting the same error. I found another question where someone had the same problem but noone replied. I even tried to set the npm registry to http://registry.npmjs.org instead of https://registry.npmjs.org, and setting the strict-ssl option to false, but it still won't work.
My npm version is 6.14.13 and my node version is v14.17.1.
Any help?
P.S.: I'm not using a proxy
Quick solution would be to delete node_modules and package-lock.json, so that when you reinstall the packages, they get installed with the lockfileVersion#1 instead of lockfileVersion#2.
I wouldn't suggest that solution though, as if you work in a team you would be forcing the others to do the same in order to fix it.
The problem is the npm version v6.x.x supports lockfileVersion#1 while v7.x.x supports lockfileVersion#2.
So a better solution would be to simply update your npm version to a v7 and higher.
Here you can find an interesting related discussion about it: Is there any way to fix package-lock.json lockfileVersion so npm uses a specific format?

how to get the dependencies of a project with a package-lock.json but no package.json?

I have a project with a package-lock.json but no package.json.
When I run npm install I get the following:
npm WARN saveError ENOENT: no such file or directory, open '/home/neubert/myproject/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/neubert/myproject/package.json'
npm WARN myproject No description
npm WARN myproject No repository field.
npm WARN myproject No README data
npm WARN myproject No license field.
up to date in 0.279s
found 0 vulnerabilities
Any ideas how I can make it so that the deps in the package-lock.json are downloaded, even if package.json isn't present?
Well my first thought would be to run
npm rebuild
If you have installed previously it will rebuild all the packages and they will print out on your screen. Then its just a matter of adding them back to a package.js
here is a link to npmjs.com and their cli commands... its handy. i have it bookmarked in my cheat sheets

unable to upgrade node js latest version

I'm trying to upgrade the node latest version not working but npm is upgraded to latest version and I don't have admin access.
I'm getting following error, When use this comment npm install node#latest
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Des
ktop\foldername\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Deskto
p\react\package.json'
npm WARN react No description
npm WARN react No repository field.
npm WARN react No README data
npm WARN react No license field.
Try adding -g flag to your command to specify that it is a global install.

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

issue using npm to install upper-case module on linuxmint OS

npm WARN saveError ENOENT: no such file or directory, open '/home/spipl8/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/spipl8/package.json'
npm WARN spipl8 No description
npm WARN spipl8 No repository field.
npm WARN spipl8 No README data
npm WARN spipl8 No license field.
this all error was occur when i try to install the upper-case modules of node.js NPM on linux mint please help me out to solve it.
I guess this is not the issue with npm, the error is saying it cannot find package.json in your directory.

Resources