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.
Related
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.
---> 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 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.
Source of problem (I think):
"scripts": {
"dev-server": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config config/webpack.config.js"
},
Error log:
> somename#1.0.0 dev-server C:\Users\Admin\Downloads\somename
> ./node_modules/webpack-dev-server/bin/webpack-dev-server.js --config config/we
bpack.config.js
'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! somename#1.0.0 dev-server: `./node_modules/webpack-dev-server/bin/webpa
ck-dev-server.js --config config/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the somename#1.0.0 dev-server script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-01-29T13_52_01_
170Z-debug.log
I am receiving this error and because of that I'm not able to: npm run dev-server.
Is there a way to replace ./ part?
Just refer to the binary directly:
"scripts": {
"dev-server": "webpack-dev-server --config config/webpack.config.js"
},
npm will run the script in an environment where all the installed packages' binaries (namely node_modules/.bin/) are directly available in PATH, including webpack-dev-server.
Also using / as a path separator is preferable in package.json - it works on Windows as well as Linux or OSX.
I am having this error message when I try to deploy my application on Heroku. Any suggestions? I can easily deploy my app on localhost but it doesn't work on Heroku.
My Package.JSON is:
{
"name":"tryout",
"version":"0.0.1",
"private":true,
"scripts":{
"start":"node app"
},
"dependencies":{
"express":"3.0.0rc3",
"jade":"*",
"passport":">= 0.1.11",
"passport-local":">= 0.1.3",
"underscore":">= 1.3.3",
"socket.io":">= 0.9.6",
"node-uuid":">= 1.3.3",
"mongoose":">= 3.0.2",
"bcrypt":">= 0.7.1"
},
"engines": {
"node": "0.8.x",
"npm": "1.1.x"
}
}
PS: I don't use hiredis at all.
Input command is: git push heroku master
Counting objects: 1731, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (1541/1541), done.
Writing objects: 100% (1731/1731), 7.42 MiB | 400 KiB/s, done.
Total 1731 (delta 192), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> Node.js app detected
-----> Resolving engine versions
Using Node.js version: 0.8.14
Using npm version: 1.1.65
-----> Fetching Node.js binaries
-----> Vendoring node into slug
-----> Installing dependencies with npm
npm WARN package.json socket-app#0.0.1 No README.md file found!
npm WARN package.json jade#0.27.2 No README.md file found!
> hiredis#0.1.14 preinstall /tmp/build_37k5gxae7u8vc/node_modules/hiredis
> make || gmake
cd deps/hiredis && make static
make[1]: Entering directory `/tmp/build_37k5gxae7u8vc/node_modules/hiredis/deps/hiredis'
make[1]: Nothing to be done for `static'.
make[1]: Leaving directory `/tmp/build_37k5gxae7u8vc/node_modules/hiredis/deps/hiredis'
node-waf configure build
Setting srcdir to : /tmp/build_37k5gxae7u8vc/node_modules/hiredis
Setting blddir to : /tmp/build_37k5gxae7u8vc/node_modules/hiredis/build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /tmp/node-node-jj2B
'configure' finished successfully (0.056s)
Waf: Entering directory `/Users/USERNAME/Developer/Sites/bla/node_modules/hiredis/build'
Waf: Leaving directory `/Users/USERNAME/Developer/Sites/bla/node_modules/hiredis/build'
Traceback (most recent call last):
File "/tmp/node-node-jj2B/bin/node-waf", line 16, in <module>
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
prepare_impl(t, cwd, ver, wafdir)
File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_impl
main()
File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
fun(ctx)
File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 386, in build
return build_impl(bld)
File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Scripting.py", line 405, in build_impl
bld.compile()
File "/tmp/node-node-jj2B/bin/../lib/node/wafadmin/Build.py", line 268, in compile
os.chdir(self.bldnode.abspath())
OSError: [Errno 2] No such file or directory: '/Users/USERNAME/Developer/Sites/bla/node_modules/hiredis/build'
make: *** [all] Error 1
sh: gmake: not found
npm ERR! hiredis#0.1.14 preinstall: `make || gmake`
npm ERR! `sh "-c" "make || gmake"` failed with 127
npm ERR!
npm ERR! Failed at the hiredis#0.1.14 preinstall script.
npm ERR! This is most likely a problem with the hiredis package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! make || gmake
npm ERR! You can get their info via:
npm ERR! npm owner ls hiredis
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.32-347-ec2
npm ERR! command "/tmp/node-node-jj2B/bin/node" "/tmp/node-npm-nN2P/cli.js" "install" "--production"
npm ERR! cwd /tmp/build_37k5gxae7u8vc
npm ERR! node -v v0.8.14
npm ERR! npm -v 1.1.65
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_37k5gxae7u8vc/npm-debug.log
npm ERR! not ok code 0
! Failed to install --production dependencies with npm
! Heroku push rejected, failed to compile Node.js app
To git#heroku.com:arcane-sea-8207.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:arcane-sea-8207.git'
It seems hiredis is indirectly needed by express, which you have a release candidate version, which might be the problem. Try to change express to:
"express":"3.x"
Also, make sure you don't commit the node_modules directory to your git repo. Add it to .gitignore!