No store/index.js file in nuxt project - vuex

I make first steps in nuxtjs ander after creation of a new project I found
only store/README.md file in store subdirectory, but not
store/index.js file as I expected
Here
https://nuxtjs.org/guide/vuex-store
I read :
We don't need to install vuex since it's shipped with Nuxt.js.
I wonder can I to add vuex to my manually and how?
I tried next successfull command :
npm install --save vuex
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.11 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ vuex#3.1.2
updated 1 package and audited 10468 packages in 7.48s
found 0 vulnerabilities
But now file store/index.js anyway? Which is the right way?
Thanks!

After recreating project I found that axios was not added to my project(but I added in wizard). Also there were store, despite what I read in docs, so I had ro run :
npm install #nuxtjs/axios
...
npm install --save store
it works for me.

You have to create it in root/store/index.js

Related

not able to create new react-native project

I am trying to create a react-native-cli project by command "react-native init projectname" but it is getting stuck by showing this line in command line after some time "info adding required Dev dependencies"
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
info Adding required dev dependencies
fsevents is optional dependency and its used only if you use macOS env, and this is not error its only warning.

Any way to avoid fsevents warnings?

Trying to get into react, using npm and such, and I often get these types of warnings:
> npm install axios redux react-redux redux-thunk react-router-dom validator redux-form
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.8 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.8 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.0.6 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ redux-thunk#2.3.0
+ validator#10.11.0
+ axios#0.18.0
+ react-router-dom#5.0.0
+ redux#4.0.1
+ react-redux#7.0.2
+ redux-form#8.2.0
added 30 packages from 100 contributors and audited 878734 packages in 23.247s
found 0 vulnerabilities
Apparently I can just ignore them, but I'm just curious if there's a way to not get these warnings? Configure npm somehow? Adding something to package.json? A flag somewhere?
You can silence the npm WARN upon installation by specifying what types of errors you want to see.
You can run npm --logevel=error install.
By using --loglevel=error you will only see npm ERROR and ignore any WARN
It's a warning, due to the operating system. fsevents run on mac os environment but in windows, it works as optional dependencies that are the reason behind your warning after all its not an error.
you can use https://github.com/paulmillr/chokidar instead of fsevents.
The problem relates to the "shrinkwrap" or package-lock.json which gets persisted after every package manager execution. Subsequent attempts keep failing as this file is referenced instead of package.json.
Adding these options to the npm install command should allow packages to install again.
--no-optional argument will prevent optional dependencies from being installed.
--no-shrinkwrap argument, which will ignore an available package lock or
shrinkwrap file and use the package.json instead
.
--no-package-lock argument will prevent npm from creating a package-lock.json file.
The complete command looks like this:
npm install --no-optional --no-shrinkwrap --no-package-lock
you can look into following answer npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.14

Error in adding vuetify on a project

I have created a vue-cli project.
And I tried to add vuetify but I couldn't do it
I've run: npm install vuetify --save
A error came out on terminal:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.3 (node_modules/sane/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
When I try to import vuetify on main.js it says that can't find the module.
Does anyone know how to fix/install it?
You could try using yarn, I find it sometimes performs better
install yarn
npm i -g yarn
Then install dependencies (run in your package.json file folder)
yarn
You can also do a clean install by first removing the nodes_modules folder, and then install without optional dependencies npm install --no-optional

npm packages added after uninstall dependencies

Why after calling npm uninstall I see message added packages?
For example:
$ npm uninstall -S redux-devtools-dock-monitor redux-devtools-log-monitor redux-devtools
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 115 packages and removed 22 packages in 20.589s
For that specific example at least here is some removed packages. Sometimes it just shows only added <n> packages message.
Could someone clarify it?
UPD: I did a little test from scratch but everything works as I expected when uninstall something. But I see such messages like above in question really often.

Understanding on installing packages using npm

I just started to use npm command while learning angularJS2. I get errors while trying to install packages using npm command, for instance when i try to run this command
npm install json-typescript-mapper --save
to install json to typescript mapper package, i am not able to install it. am i missing something, should i change the registry? my current registry is http://registry.npmjs.org/ should i have to change the registry inorder to install the package
ERROR
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
and after that when i try to import the package, i get an error stating the package not found because the package was not added