when i write in cmd prompt about npm -v this mssg comes? - javascript

'CALL "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.
8.19.3
what should i do to solve this?n

Related

Errors when installing WebdriverIo

Installing wdio packages:
- #wdio/local-runner
- #wdio/mocha-framework
- #wdio/spec-reporter
- wdio-chromedriver-service
- chromedriver
npm WARN deprecated #types/easy-table#1.2.0: This is a stub types definition. easy-table provides its own type definitions, so you do not need this installed.
added 115 packages, and audited 459 packages in 13s
92 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Packages installed successfully, creating configuration file...
Config file installed successfully, creating test files...
Configuration file was created successfully!
To run your tests, execute:
$ npx wdio run wdio.conf.js
Adding "wdio" script to package.json.
Unknown command: "set-script"
Did you mean this?
npm run-script # Run arbitrary package scripts
To see a list of supported npm commands, run:
npm help
file:///C:/Users/User/AppData/Local/npm-cache/_npx/46b5fbaa5aefb2df/node_modules/create-wdio/build/utils.js:19
return reject(new Error((error && error.message) ||
^
Error: Error calling: npm set-script wdio wdio run wdio.conf.js
at ChildProcess.<anonymous> (file:///C:/Users/User/AppData/Local/npm-cache/_npx/46b5fbaa5aefb2df/node_modules/create-wdio/build/utils.js:19:31)
at ChildProcess.emit (node:events:513:28)
at cp.emit (C:\Users\User\AppData\Local\npm-cache\_npx\46b5fbaa5aefb2df\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)
Node.js v18.12.1
npm ERR! code 1
npm ERR! path C:\Users\User\Downloads\webdriverio
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-wdio .
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-11-26T14_16_31_932Z-debug-0.log
I don't understand why did I get such errors? Now I'll try to describe you detailed what I did I made several steps:
Download the latest node.js version via https://nodejs.org/en/download/
I set NODE_HOME in system variables
Created empty folder
Opened empty folder in command prompt, (cd 'path to this empty folder')
Wrote 'npm init wdio .' into the command prompt
Then I just chose the default options
I was waiting and such errors appeared
I tried to update npm to the latest version. It doesn't help.

can not run js file with nodemon

I install nodemon from npm in project but cant run js file with 'nodemon run start' and facing this error:
nodemon : The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
You need to install nodemon globally using the -g option.
npm install -g nodemon
This will add nodemon to your PATH environment variable so that your terminal knows where the executable file for nodemon is.
Otherwise your terminal doesn't know which executable you're trying to run.
Your second option is to run it through npx.
Use the following:
npx nodemon {filename}
npm will handle locating and running the executable for you. The npx command is installed on your computer by default when you install npm.
You will need to install nodemon if you haven't already
for dev environment run
$ npm install --save-dev
to install nodemon globally run
npm install -g nodemon
to run your app/server use
nodemon app
If the name of your entry file is not app use its name in the command
nodemon {filename}

Cant build React app - pipeline fails miserably

---> Running in 0e34d471598d
> myproject#1.0.0 build /app
> node scripts/build.js
Could not find a required file.
Name: index.html
Searched in: /app/public
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myproject#1.0.0 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myproject#1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-05T14_49_57_665Z-debug.log
The command '/bin/sh -c npm run build ;' returned a non-zero code: 1
##[error]The command '/bin/sh -c npm run build ;' returned a non-zero code: 1
##[error]The process '/usr/bin/docker' failed with exit code 1
So there is the error "can't find file" but actually THERE IS a public directory with the index.html file inside. I don't know why this is happening...
Edit: Im adding the docker file used in config pipe
# -- Base node --
FROM node:13.7-alpine AS build
WORKDIR /app
COPY package.json /app
RUN npm install
COPY . /app
ARG BUILD_ENV
RUN npm run build ;
# -- final build --
FROM nginx:1.17.8-alpine
COPY --from=build /app/build /var/www
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
I notice you are running this on docker, so you did wrong on docker during copy your react app directory to docker container.
You have not added your Dockerfile code here
So we suggest you to fix your dockerfile first. Also check your .dockerignore file and debug getting into docker container, if the directory exist there or not
So your docker file should be similar to this
COPY . ./
RUN npm run build
It should be like this (Not . /app):
# Copy other project files and build
COPY . ./
RUN npm run build

I keep getting this error after typing npm start into the terminal

I keep getting these errors. Recently developed a simple web app and posted on my repository and kept getting these errors thereafter.
npm ERR! code ELIFECYCLE – David 1 hour ago
npm ERR! syscall spawn C:\Windows\system32\cmd.exe;C:\Users'username'\AppData\Local\GitHub\PortableGit_'numbersandletters'\cmd\git.exe; C:\Program Files\nodejs
npm ERR! file C:\Windows\system32\cmd.exe;C:\Users'username'\AppData\Local\GitHub\PortableGit_'numbersandletters'\cmd\git.exe; C:\Program Files\nodejs
npm ERR! path C:\Windows\system32\cmd.exe;C:\Users'username'\AppData\Local\GitHub\PortableGit_'numbersandletters'\cmd\git.exe; C:\Program Files\nodejs
npm ERR! errno -4058 npm ERR! robofriends#0.1.0 start: react-scripts start
pm ERR! spawn C:\Windows\system32\cmd.exe;C:\Users'username'\AppData\Local\GitHub\PortableGit_'numbersandletters'\cmd\git.exe; C:\Program Files\nodejs ENOENT npm ERR! npm ERR! Failed at the robofriends#0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\hp\AppData\Roaming\npm-cache_logs\2021-01-09T03_19_55_548Z-debug.log C:\Users\hp\Desktop\David\robofriends>
i kept getting erros even after deleting the node modules and package.json, i uninstalled node and installed again, ran npm innit to get my package.json and i got this error
'CALL "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.
ENOENT means no such file or directory, meaning something being referenced by some process doesn't exist where the process thought it did, such as the node executable, cmd.exe, or the react-scripts executable in node_modules. In this case it seems to be a Windows-specific issue. Adding cmd.exe to your path may fix things. See this question for more.

HelloWorld vert.x not starting

I'm trying to get a vert.x HelloWorld project running based on this: https://vertx.io/blog/vert-x3-says-hello-to-npm-users/
I've done npm init and installed vertx3-min 3.8.3. But when i execute "npm start" I get the following error:
vertxdemo#1.0.0 start C:\Users\Tiago Redaelli\Desktop\VertxDemo
vertx run server.js
C:\Users\Tiago Redaelli\Desktop\VertxDemo>#!/bin/sh
'#!' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Tiago Redaelli\Desktop\VertxDemo>basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
'basedir' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Tiago Redaelli\Desktop\VertxDemo>case `uname` in
'case' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Tiago Redaelli\Desktop\VertxDemo>*CYGWIN* | *MINGW* | *MSYS*) basedir=`cygpath -w "$basedir"`;;
'*CYGWIN*' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! vertxdemo#1.0.0 start: `vertx run server.js`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the vertxdemo#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Tiago Redaelli\AppData\Roaming\npm-cache\_logs\2019-10-23T09_18_52_079Z-debug.log
PS C:\Users\Tiago Redaelli\Desktop\VertxDemo>
The part trying to start server.js taken from the example looks like this:
"start": "./node_modules/.bin/vertx run server.js"
This is the project directory
Update
After installing vertx 3.8 and setting the path to C:\Program Files\vertx\bin I can enter "vertx version" but it still complains over the contents in the shell file as seen previously.
This is the file referenced by the start command:
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir//bin/bash" ]; then
"$basedir//bin/bash" "$basedir/../vertx3-min/vertx/bin/vertx" "$#"
ret=$?
else
/bin/bash "$basedir/../vertx3-min/vertx/bin/vertx" "$#"
ret=$?
fi
exit $ret
You're on windows operating system, so your start script should be the bat one:
vertx.bat
Try replacing the previous commands with that one instead and your application should work.

Categories