Why my node_modules folder is excluded in my phpStorm? - node.js

[Hello guys! every time i run the npm installcommand, it creates the node_modules folder, but the folder is excluded! Also i have some warnings as you can see, but i think that npm install is done successfully.
the Warnings that i get are the following:
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN prefer global marked#0.3.6 should be installed with -g
npm WARN prefer global node-gyp#3.4.0 should be installed with -g
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.15: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
The first 3 warnings are from the gulp depentency. and the last 2 i can pass them by, if i type the following code in the package.json:
*"optionalDependencies": {
"fsevents": "*"
},*
and then type into the terminal the command npm install --no-optional.
But i can't understand why my node_modules folder is excluded and PhpStorm(2016.2.2) doesn't allow me to unexcluded it.
Thank you!]1

I believe they're not considered source files, as the contents of the node_modules folder are imported dependencies.
Having that folder excluded helps to to speed up searching in your project; as PhpStorm doesn't need to search through all the external modules.
This is what the JetBrains documentation has to say:
Excluded folders are not involved in indexing and therefore they are ignored while searching, parsing, watching etc.,
So there's nothing wrong with having a folder marked as 'excluded'.
However, should you want to un-exclude the node_modules folder, have a look at this thread on JetBrains support. This thread was started by someone with the same problem. One of the suggestions there:
Please open "Settings | Languages & Frameworks | JavaScript | Libraries" and locate "/lib/node_modules" library. Is it enabled? If no, just enable it. Will it bring expected code completion and navigation in your main application for modules imported from lib/node_modules?

Related

node-sass: command not found

I'm using Atom and trying to autocompile SCSS with the 'SASS Autocompile' package.
I'm absolutely going mad trying to get it to work. I'm being told node-sass: command not found and have followed countless guides and articles which mostly say run npm install node-sass. I do that, and it installs ok but Atom still gives me an error when I save a SASS file.
I have no idea if I'm running these commands in the correct location - on my local user level, in my project folder etc. The guides are so vague for someone who's not doing this all day every day.
I can't believe this is modern web development where you just have no way of knowing what is causing issues, no simple way to remove and reinstall things and we're all flying blind trying to fix things.
If anyone has some ideas of what I could try, I would love to hear them.
$ npm i node-sass
npm WARN deprecated mkdirp#0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
> node-sass#4.13.1 install /Users/tommyprsnl/Sites/ozspurs/node_modules/node-sass
> node scripts/install.js
Cached binary found at /Users/tommyprsnl/.npm/node-sass/4.13.1/darwin-x64-72_binding.node
> node-sass#4.13.1 postinstall /Users/tommyprsnl/Sites/ozspurs/node_modules/node-sass
> node scripts/build.js
Binary found at /Users/tommyprsnl/Sites/ozspurs/node_modules/node-sass/vendor/darwin-x64-72/binding.node
Testing binary
Binary is fine
npm WARN ozspurs No description
npm WARN ozspurs No repository field.
npm WARN ozspurs No license field.
+ node-sass#4.13.1
updated 1 package and audited 528 packages in 4.857s
found 0 vulnerabilities

React Starter Kit Reports Unexplained Missing Packages

Let me start by stating that I am a rank beginner with respect to React/JS, but far from a beginner overall; my experience is varied, and includes, among many other things, some work with Angular/JS. Hence, this is not my first exposure to the Node/JS ecosystem.
The current investigation began with a missing peer report that I received when I installed the Material_UI package into the directory into which I had just installed the React Starter Kit, which gave the following report.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
> uglifyjs-webpack-plugin#0.4.6 postinstall F:\Praesidium\Armatus_Admin_EventRegistration\React\material_ui_table_demo\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
+ react-scripts#1.1.2
+ react#16.3.0
+ react-dom#16.3.0
added 1327 packages in 86.861s
Success! Created material_ui_table_demo at F:\Praesidium\Armatus_Admin_EventRegistration\React\material_ui_table_demo
Inside that directory, you can run several commands: ...
Installing Material_UI elicited the following report.
npm install material-ui#next
> jss#9.8.1 postinstall F:\Praesidium\Armatus_Admin_EventRegistration\React\material_ui_table_demo\node_modules\jss
> node -e "console.log('\u001b[35m\u001b[1mLove JSS? You can now support us on open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/jss/donate\u001b[0m')"
Love JSS? You can now support us on open collective:
> https://opencollective.com/jss/donate
npm WARN ajv-keywords#3.1.0 requires a peer of ajv#^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ material-ui#1.0.0-beta.40
added 47 packages in 23.878s
After investigating the AJV package, I decided to generate a dependency tree from the starter kit. The dependency tree reported one peer dependency, on the aforementioned AJV package, which went unreported by the installer.
More puzzling, however, is the list of allegedly missing packages reported by npm list.
material_ui_table_demo_Packages_Skeleton_20180402_211705.TXT is the npm list report covering the React Starter Kit.
material_ui_table_demo_Packages_Skeleton_20180402_211705_STDOUT.TXT is the list of missing packages, which were reported on the terminal console.
Since it affects the dependency tree, it is important that you are aware that this installation is on Microsoft Windows 10 Professional, and that the installed NPM and Node versions are 5.6.0 and v8.10.0, respectively.
The React Starter Kit Installation Instructions are dead silent about unresolved dependencies that a developer must address. Which report do I believe, the dependency tree or the missing packages reported separately by the very same npm list?
The issue of not installing packages on the first npm install has been popping up up here in there.
Running npm install again for a second time usually solves the problem, but in some cases (like this) you have to force a package version by doing the following steps:
Delete the node_modules folder
Delete the package-lock.json
Add the exact dependency to the package.json (in our case ajv#^6.0.0)
Execute npm update (just in case)
Execute npm install
Now the pm ERR! peer dep missing: ajv#^6.0.0, required by ajv-keywords#3.1.0 is no longer!
Note: how to add the dependency:
...
"dependencies": {
"ajv": "^6.0.0",
...
Why? Its a bug with the dependency system of npm (they added a hacky solution at some point and then they removed it, they have said they will rewrite the whole dependency system at some point)

node cmd getting hangs while doing 'npm install' at fsevents point

i am trying to install anugalr2 through npm command "npm install". but when it reaches some point that is in fsevets. the command prompt getting stuck. nothing is happening after that. PFb the cmd image
any suggestions /advice will be helpful
Update :
when i try with npm i --no-optional. it is getting stuck at ""core-js" package
D:\Angular2\quickstart-master>npm i --no-optional
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or highe
to avoid a RegExp DoS issue
npm WARN deprecated express#2.5.11: express 2.x series is deprecated
npm WARN deprecated connect#1.9.2: connect 1.x series is deprecated
[ ......] - extract:core-js: sill pacote core-js#https://registry.n
after i cleaned npm cache it worked for me
npm cache clean --force
As #RidgeA said in their comment...
Use npm i --no-optional. This will not install optional dependencies, one of which is fsevents. The reason it is getting stuck is because fsevents is written for Mac (see https://www.npmjs.com/package/fsevents).
I can see your path is not that long but in my case a problem was with a too long path.
So the solution was to move project to a location with shorter path, like: D:\my-project\
I managed to install without problems after moving the project to a folder with a shorter path. C:\Themes
After updating npm version I forgot about this problem.
npm won't work if you try to install on USB devices, try changing the directory to your hard drive.

Google polymer starter kit WARN when npm install

When I download "Intermediate - Advanced users" version of polymer starter kit from github here and on the 4th step of these instructions here I always getting these WARNs:
$ sudo npm install
npm WARN deprecated gulp-minify-css#1.2.4: Please use gulp-clean-css
npm WARN deprecated graceful-fs#3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN engine launchpad#0.5.1: wanted: {"node":"^0.12"} (current: {"node":"4.4.2","npm":"2.15.0"})
npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN optional dep failed, continuing fsevents#1.0.11
npm WARN deprecated graceful-fs#1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN deprecated jade#0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
No matter what OS I'm using: tried both Ubuntu and Windows (git bash).
I have npm, bower, gulp installed globally but there's always those WARNs.
I think that maybe it's a dependencies problem or it's because of some code in some of polymer starter kit files, but I'm not a pro developer, so I can't find what is causing the problem
It's all seems to work though when I deploy the project, but I'm new to web dev and not sure if I have to just close my eyes on these WARNs
Nothing to worry about with those warnings. Those come from the npm packages that are set as dependencies in the package.json file. When you run npm install it will install all packages set in the package.json. Every single package has their own package.json that also has some dependenices. Each package install their own needed version of that package and sometimes they use older versions of those packages. Only way to get rid of those warnings would be to get the package creators to update their packages.
Only package that you can update yourself is the gulp-minify-css. You can uninstall that package npm remove gulp-minify-css --save-dev and install the newer non-deprecated version gulp-clean-css. npm install gulp-clean-css --save-dev. If you do that you need to update the gulpfile.js for the project to use the new package.
Find the styleTask for the starter-kit in the gulpfile.js:
var styleTask = function(stylesPath, srcs) {
return gulp.src(srcs.map(function(src) {
return path.join('app', stylesPath, src);
}))
.pipe($.changed(stylesPath, {extension: '.css'}))
.pipe($.autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(gulp.dest('.tmp/' + stylesPath))
.pipe($.minifyCss())
.pipe(gulp.dest(dist(stylesPath)))
.pipe($.size({title: stylesPath}));
};
and change the .pipe($.minifyCss()) row to be .pipe($.cleanCss({compatibility: 'ie10'}))
Now you have managed to update the starter-kit to use newer non-deprecated package.
Many packages in the npm package manager have some deprecated packages or cause other warnings while installing but most of the time there is no need to worry.
No need to worry about those warnings in this case. They shouldn't cause the problems that you allude to. I verified the PSK guide you mentioned (the page completely appears and functions without error in Chrome Version 49.0.2623.112 on OSX El Capitan).
npm displays deprecation warnings when a dependency being installed has been deprecated by the dependency's package owner/maintainer usually in favor of another package/version that has significant improvements. Packages can be deprecated/undeprecated at will and long after your app has been deployed.
For example, in January, you release an app that depends on gulp-minify-css#1.2.4. The owner of gulp-minify-css no longer has time to maintain the package, so he decides in March to deprecate it in favor of the actively maintained gulp-clean-css. Now, users who npm install your app (which also installs gulp-minify-css) see this deprecation warning, but your app still functions normally. The deprecation does not invalidate your app or cause errors.
While normally one might try to upgrade the dependencies to remove the warnings, that is not recommended for PSK due to package incompatibilities as recently discovered in a pull request:
So I just took this for a spin and I ran into some issues :( although
the current gulp plugins are deprecated they are working for the
community! This PR represents a "high risk" change, that we have found
to be breaking in several odd ways. For that reason I am going to
close this PR for now. That said let's revisit this PR in a few months
and see if things have stabilized more.

Updating to nodejs 4x MEAN stack

So I've been using node v 0.10x and 0.12x for dev and prod environments.
Now we need to upgrade to v4x and as I'm doing so, I'm finding that is not so easy, gcc compiler issues, deprecated libs...
Here are some of the messages I'm getting
I was able to overcome the c++11 problems
Updating to Node.js 4
Node on old distributions
Now what I would like is to have the builds as clean as possible,
as well as to know what is the impact of having this deprecated libraries in the project in the short/long term,
is it possible to completely get rid of them? if so is there a kind of best practices approach for this?
For instance I updated lodash#1.0.2 to version 4 in the main package.json file just to find/get more deprecated libraries like a nested deprecated libraries, so is it really possible to get rid of this deprecated libraries?
If you are migrating from v0.1 to v.0.2, you need create a node link between the local and the global modules.
About the warnings,
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents#1.0.8
Don-t be afraid about the after update all the packages, some packages are marked as deprecated but the doesn't have any update available, then if you tried update them, don't worry, that doesn't affect your project.
And releated with the last of your issues:
UNMET PEER DEPENDENCY kerberos#~0.0
First one you need update your kerberos development package:
apt-get install libkrb5-dev
And running the command:
npm install --save kerberos mongod
If that doesn't fix your issue, you could try in a manual way intall all the packages with:
git clone https://github.com/christkv/kerberos.git
cd kerberos
npm install
npm install -g node-gyp
cd ~/JesusTheProject
npm install mongodb --save
npm --loglevel verbose install mongodb

Resources