node-sass: command not found - node.js

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

Related

Can't get create-react-app to work on Linux mint 21

I am trying to get a simple create-react-app to work, but nothing seems to work. With Linux Mint the terminal sends few warnings but can't get the create-react-app to function.
~/Documents/Code$ npx create-react-app testreact Creating a new React
app in /home/omistaja/Documents/Code/testreact.
Installing packages. This might take a couple minutes. Installing
react, react-dom, and react-scripts...
npm WARN deprecated stable#0.1.8: Modern JS already guarantees
Array#sort() is a stable sort, so this library is deprecated. See the
compatibility table on MDN:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated rollup-plugin-terser#7.0.2: This package has been
deprecated and is no longer maintained. Please use
#rollup/plugin-terser npm WARN deprecated w3c-hr-time#1.0.2: Use your
platform's native performance.now() and performance.timeOrigin. npm
WARN deprecated sourcemap-codec#1.4.8: Please use
#jridgewell/sourcemap-codec instead npm WARN deprecated svgo#1.3.2:
This SVGO version is no longer supported. Upgrade to v2.x.x.
added 1415 packages, and audited 1416 packages in 41s
231 packages are looking for funding run npm fund for details
6 high severity vulnerabilities
To address all issues, run: npm audit fix
Run npm audit for details.
A template was not provided. This is likely because you're using an
outdated version of create-react-app. Please note that global installs
of create-react-app are no longer supported. You can fix this by
running npm uninstall -g create-react-app or yarn global remove
create-react-app before using create-react-app again.**
Running the audit fix returns
up to date, audited 101 packages in 1s
20 packages are looking for funding run npm fund for details
found 0 vulnerabilities
In addition to the warnings the terminal does not start the "quick tips" part (which starts with npm start and ends in Happy hacking!)
The created folder only contains following
node_modules (folder)
package.json
package-lock.json
with windows the folder also contains
public
src
.gitignore
README.md
going to the folder and running npm start returns Missing script error (which is to be found in the comments)
I am using running
Linux mint 21
node v18.14.1.
npm v. 9.3.1.
I have uninstalled and removed couple of times and nothing seems to fix that.
I also tested my commands with windows Git Bash (i have a dual-boot machine) and seems to work fine with the commands I am giving it.
Any ideas?
Not sure what the specific problem was but fixed it bt restoring the system to a few days back (before started working on updating the node.js to current version and trying to create-react-app for the first time).
After restoring the system I did a fresh autoremove on the node and install to the current nodejs version 18.14.1. it all just worked.

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)

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

NPM warn message about deprecated package

I am installing a module globally
$ npm install -g X
and NPM says
"npm WARN deprecated lodash#1.0.2: lodash#<3.0.0 is no longer
maintained. Upgrade to lodash#^4.0.0"
how can I find out which module has an dependency on this old version of lodash?
The warning message from NPM doesn't seem to give me any clue which module references this old version (I believe that the module X does not have a direct dependency on this old version of lodash.).
I got an answer for the similar question: https://stackoverflow.com/a/36335866/1115187
Briefly:
npm outdated --depth=3
This command will analyze installed NPM-packages and their versions. The report will contain:
package name
latest version
current version
dependency path (down to depth level)
Hope, this information could help you to gather info about outdated packages.
Next step - get in touch with maintainers of the appropriate package, and ask them to update the package (maybe, you would like to send a pull request).
UPD: npm-check
There is a great npm package: npm-check, that allows checking outdated dependencies. Probably
My favorite feature: Interactive Update — run npm-check -u in the project folder. An interactive menu shows all required information about dependencies in the current folder and allows to update all dependencies in 3 seconds.
npm la <package-name>
also works, and will give you the most details about the dependency graph of a dependency.
npm ls <package-name>, does something similar but gives you less details
Use npm list. It will print out all of the packages your module depends on as well as your dependencies dependencies and so forth. Maybe redirect output to a file or grep it so you can search it more easily.
use this
sudo npm install --unsafe-perm -g expo-cli
You could search through all the package.json files under node_modules and see which ones are dependent on lodash 1.0.2.
For deprecated files you should use the "npm i [package]" syntax, in this case you should use: npm i X and it will fetch all necessary packages, including deprecated ones, but which are required for your installation.
Npm documentation link: https://docs.npmjs.com/using-deprecated-packages

Resources