How to run the official vue.js examples? - vue.js

I git cloned vue, cd'ed into one of the examples folder and ran npm install. Everything went fine, then I ran npm run dev and it gets stuck at this stage. Is there anything else I should do to run this locally?
npm run dev
> vue#2.4.2 dev /vue
> rollup -w -c build/config.js --environment TARGET:web-full-dev
bundling...
bundled in 2456ms. Watching for changes...

You need to run a local web server.
Try this:
Install http-server package with npm:
$ sudo npm install -g http-server
Run it in the root of the vue cloned folder:
$ git clone git#github.com:vuejs/vue.git
$ cd vue
$ http-server -o -c .
In yout browser, navigate to the examples folder, for instance:
http://127.0.0.1:8081/examples/select2/
They are the same from here:
https://v2.vuejs.org/v2/examples/

Related

Run yarn from Dockerfile in ddev

This is a followup to How can I add and use nvm in a DDEV web container?
My dockerfile now looks like this:
ARG BASE_IMAGE
FROM $BASE_IMAGE
ENV NVM_DIR=/usr/local/nvm
ENV NODE_DEFAULT_VERSION=v8.16.1
RUN curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh -o install_nvm.sh
RUN mkdir -p $NVM_DIR && bash install_nvm.sh
RUN echo "source $NVM_DIR/nvm.sh" >>/etc/profile
RUN bash -ic "nvm install $NODE_DEFAULT_VERSION && nvm use $NODE_DEFAULT_VERSION"
RUN chmod -R ugo+w $NVM_DIR
RUN npm install -g foundation-cli
RUN npm install -g gulp-cli
RUN yarn --cwd foundation-src install
The last line returns an error: Service 'web' failed to build: The command '/bin/sh -c yarn --cwd foundation-src install' returned a non-zero code: 1'
When I ddev ssh and then run yarn --cwd foundation-src install it does the job (running yarn in the foundation-src folder).
I also tried RUN (cd foundation-src; yarn install;) but no luck either. I prefer the first command anyway. But what is going on? Why can I run stuff from inside the container but not from the dockerfile?
Your command is RUN yarn --cwd foundation-src install - it's assuming that there is a subdirectory "foundation-src" under the current directory.
But the Dockerfile is running long, long before your source is anywhere useful. The container has not been run yet, nothing is mounted. So you can't do things that require your source code to be present.
Since this command appears to require your source code to be present, I think you'll be better doing this as a post-start hook, perhaps
hooks:
post-start:
- exec: "yarn --cwd foundation-src install"
Since actions like yarn install happen irregularly, it's also easy to ddev exec yarn --cwd foundation-src install and also easy to create a custom command to do that when you need it.

How install and run vue js application on Centos 7

I want to install vuejs and run it on Centos 7, I want to run it inside a specific folder.
[updated]
It's a little bit different, but works fine to me on CentOS 7
(deprecated but working fine)
$ curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
$ sudo yum install -y nodejs
$ node --version
$ npm --version
$ sudo npm install -g #vue/cli
$ vue create [projectname]
go to the folder of project name:
$ cd projectname
$ npm run serve
open your internet browser and type http://localhost:8080/
You need to install Node and NPM first. On CentOS 7 you can do this by running the following commands.
curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
sudo yum install nodejs
After this, confirm that Node and NPM are installed by running node --version and npm --version.
Then you need to install vue-cli. This makes creating Vue applications very easy. Install it by running npm install -g #vue/cli. After that has installed, you can create new projects by running vue create <project-name>. Once you have created the project, you can run it locally using npm run serve.

How to install yo on node#12 and npm#6.9.0 with zshrc via homebrew

I have been trying to install yo to integrate and test botkit but had issues with yo and npm and node as I updated brew on my mac to the latest. Here is how I resolved it.
If you have installed latest node 12 on your mac using latest update of homebrew(if you haven't updated and want to, please update brew by running brew update and run brew install node).
Run the following commands to verify node and npm are updated to 12 and 6.9.0
[keshav#xxxxxx-mbp ~ ]$node -v
v12.1.0
[keshav#xxxxxx-mbp ~ ]npm -v
6.9.0
If this is what you see on your console, you are good to proceed to next steps.If not, please add a comment if you are facing a error.
Run the following commands
echo export PATH="$HOME/npm/bin:$PATH" >> ~/.zshrc
npm config set prefix ~/npm
echo "export NODE_PATH=$NODE_PATH:/home/$USER/npm/lib/node_modules" >> ~/.zshrc && source ~/.zshrc
npm install -y -g yo
Once you run the command in step 4, you should see the below output in the console.
Output of command 4
npm install -y -g yo
npm WARN deprecated cross-spawn-async#2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/Users/xx/npm/bin/yo-complete -> /Users/xx/npm/lib/node_modules/yo/lib/completion/index.js
/Users/xx/npm/bin/yo -> /Users/xx/npm/lib/node_modules/yo/lib/cli.js
yo#2.0.6 postinstall /Users/xx/npm/lib/node_modules/yo
yodoctor
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
✔ NODE_PATH matches the npm root
✔ yo version
Everything looks all right!
+ yo#2.0.6
updated 1 package in 5.752s

Error: node_modules directory is missing. Please run `npm install` in your project directory

expo start
[21:03:34] Starting project at /home/sadaif/Documents/React-Native-App/my
[21:03:35] Expo DevTools is running at http://localhost:19002
[21:03:35] Opening DevTools in the browser... (press shift-d to disable)
[21:03:41] Error: node_modules directory is missing. Please run `npm install` in your project directory.
[21:03:41] Couldn't start project. Please fix the errors and restart the project.
[21:03:41] Set EXPO_DEBUG=true in your env to view the stack trace.
I run this command npm install but noting happened
then i run these commands
rm -rf node_modules
rm package-lock.json
npm cache clear --force
npm install
When I run command expo start then this error show in the terminal .I'm Using first time expo cli i m a beginner so that's why have no idea how to fix this issue if anyone know please help me.
either you are using Mac or Ubuntu the directory you have created the project in needs superuser permissions to modify it.
either run all commands with sudo or change the ownership
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
or re-install the node with
npm install -g node#latest --unsafe-perm

Babel Errors in Cloud 9 IDE

Getting a bunch of babel errors when running npm run dev with the Vue cli.
This only happens in Cloud9.
Any thoughts on what could be the issue or how to disable errors like this before running npm run dev?
All babel related it looks like.
I couldn't re-create the babel error messages but it's possible that it could be caused if npm/node is not up-to-date. (Vue-cli wasn't starting dev server before the installation below)
Is your repository public where you're getting the error messages? Then I could have a look at the errors.
If removing node_modules folder is not helping,
here is how you can create a new IDE workspace for vue.js ($ for commands in bash terminal):
Create a blank Ubuntu workspace
Check that nvm is installed & up-to-date with (check version of install script here):
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
$ nvm install node 6
$ npm i vue-cli -g
$ vue init webpack yourAppName
$ cd yourAppName
$ npm install
$ npm run dev
Click preview to test that Vue server is running as expected
Here is a link to a HelloWorld Vue app in cloud9 ide.
If you have an existing app you can also use git to clone it into your new workspace instead of creating a new app.