nodejs project build through jenkins - node.js

Hi Iam new to nodejs projects.
I am building a cicd pipeline for jenkins. I configured git and in build section iam using npm install for build in jenkins.
The build shows success bot no node_modules or target getting generated. Below message shows package.jsonis missing but that is my jenkins workspace.
This is my error:
npm install
npm WARN saveError ENOENT: no such file or directory, open '/var/lib/jenkins/workspace/test2/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/var/lib/jenkins/workspace/test2/package.json'
npm WARN test2 No description
npm WARN test2 No repository field.
npm WARN test2 No README data
npm WARN test2 No license field.
up to date in 0.061s
Finished: SUCCESS

Please check if package.json file is present in folder /var/lib/jenkins/workspace/test2/

Related

Getting error: "saveError ENOENT: no such file or directory, open '.../package.json'

I am attempting to install newsapi via the command: npm install newsapi --save.
That installs two dependent packages (core-js and node-fetch) as well as newsapi itself. I run the command in my project folder. I have no issues with core-js and node-fetch, but I get the following warnings regarding newsapi.
npm WARN saveError ENOENT: no such file or directory, open 'Users/user_name/project/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 'Users/user_name/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.
After the installation, package-lock.json is created in my project folder and Users/user_name/project/node-modules/newsapi/package.json does exist. I don't know why the installation asks me to open Users/user_name/project/package.json. Why would it be in my project folder and not in the module's folder?
I tried solutions I read in other threads including deleting package-lock.json and retrying the installation and using npm init. Neither of those methods worked.
I also tried copying and pasting package.json to the project folder (because the warnings prompt me to open Users/user_name/project/package.json) but that did not solve my problems either.
How can I successfully install the module?

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.

Module 'googleapis' is not listed as dependency in package.json

Step 1: I try to add googleapis as dependency and got the error
$ npm install googleapis
npm WARN saveError ENOENT: no such file or directory, open '[home]/package.json'
npm WARN enoent ENOENT: no such file or directory, open '[home]/package.json'
npm WARN saly No description
npm WARN saly No repository field.
npm WARN saly No README data
npm WARN saly No license field.
Question: Why is it looking for the file in my home directory as opposed to my project directory? Especially since I am making the call from my project directory.
Step 2: I misunderstood the error and proceeded to deploying my project and that's where I got the error
Module 'googleapis' is not listed as dependency in package.json
Step 3: I now try npm i googleapis --save but I still get the same errors as in steps 1 and 2.
It seems that the problem was due to that I forgot to cd into the functions directory before I tried to install the dependencies.

No such file package.json when running npm i

When I run the following commands:
npm i && npm run
I get the following error:
npm WARN saveError ENOENT: no such file or directory, open '/Users/Singh/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/Singh/package.json'
npm WARN Singh No description
npm WARN Singh No repository field.
npm WARN Singh No README data
npm WARN Singh No license field.
Why am I getting this error and how do I fix it?
First check there is package.json file or not if not create package.json file using npm init
The problem is that you're in the wrong directory -- you're in your user directory. If you cloned something from a repository, make sure you navigate to that directory before running npm i:
cd path/to/cloned/project
npm i && npm run <script_here>

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