npm install suddenly fails - node.js

I have been able to install node modules locally in a project for quite some time. All of sudden ALL attempts at installation fail, with the same type of error:
Homers-MacBook-Pro:test homer$ npm install bootstrap#3
/Users/homer
└── bootstrap#3.3.7
npm WARN enoent ENOENT: no such file or directory, open '/Users/homer/package.json'
npm WARN homer No description
npm WARN homer No repository field.
npm WARN homer No README data
npm WARN homer No license field.
I'm not using a package.json file, just hoping to install some modules in a local node-modules directory. I don't understand why npm suddenly thinks it needs a package,json in my Home directory.
I'm on MacOS 10.12.4. There have been no upgrades in the system or in Node since the last successful npm install a couple of weeks ago.

This is just a warning, not errorwhich means you can ignore it. And your package has been successfully installed.
npm WARN homer No description // no description in package.json
npm WARN homer No repository field. // no repository setted in package.json
npm WARN homer No README data // no introcude md found
npm WARN homer No license field. // no lisence type setted in package.json
Above warn messages is all about details of package.json which were caused by package.json not found.
package.json is a config file which stores libraries that you installed by npm. So that you don't have to copy/manage these libraries manually and locally.
Next time for a new environment, you can simply reprocude the denpendencies by npm install, and npm will read your package.json and reinstall packages stored in it.
As commented by #peteb (thanks again), while install packages via npm install [packages], npm will try to check whether your newly installed package is listed in package.json . If the file doesn't exist, then this warn message will be shown.

Related

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

Warnings when installing npm modules in project directories, but not when installing globally

I have observed this issue when installing both newsapi and RequireJS. The path to my project directory is as follow: Users\username\project
In my project directory, when I run npm install newsapi --save (installation instructions per the newsapi site or npm install requirejs (installation instructions per the RequireJS site, I get the following identical warnings:
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\username\project\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\username\project\package.json'
npm WARN project No description
npm WARN project No repository field.
npm WARN project No README data
npm WARN project No license field.
It may be worth noting the project\node_modules\newsapi and project\node_modules\requirejs are still created and they seems to be populated as they should.
I noticed that when I install the modules globally (by running npm install -g newsapi --save or npm install -g requirejs) the installation succeeds without displaying any warnings. Why is this the case? What is happening in my project folder that might be causing this issue?
npm install fhqhwhgads will try to update the local project package.json but npm install -g fhqwhgads will install globally and so there's no package.json to update. So that's why you're note getting an warning with global installation.
If you want to create a package.json so that your dependencies can be tracked and replicated by others (or if you want to publish your code as a package), you can use npm init.

can't install npm package in google cloud functions

I am new in using google cloud functions. I am trying to use expressjs in the my google cloud functions folder. I run npm i express on my terminal. but I get errors like this
npm WARN saveError ENOENT: no such file or directory, open '/Users/muchammadagunglaksana/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/muchammadagunglaksana/package.json'
npm WARN muchammadagunglaksana No description
npm WARN muchammadagunglaksana No repository field.
npm WARN muchammadagunglaksana No README data
npm WARN muchammadagunglaksana No license field.
+ express#4.17.1
updated 1 package and audited 17547 packages in 4.294s
it seems the package is installed, but the express dependecies is not automatically added on package.json
Change directory (cd) to your functions folder before running the command. npm assumes that package.json is in the current working directory in order to make changes to it.

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

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