CSSO npm not working while others are - node.js

I’m new to Node.js & npm and am trying to figure out why the uglifyjs module is working while the csso module is not.
i recently moved my global install to following location
/Users/myname/.node_modules_global/bin/npm
via this tutorial’s recommendation.
https://www.sitepoint.com/beginners-guide-node-package-manager/
to show they are both installed globally i do this via the command line
npm list -g --depth=0
and i get this result
/Users/myname/.node_modules_global/lib
csso#3.1.1
npm#5.3.0
uglify-js#3.0.25
for testing purposes i navigate to a local static site and run the commands using the CLI.
the uglifyjs command works. but when running the command for csso which is
$csso style.css style.min.css
i get this error
bash: csso: command not found
i’m at a loss how to even troubleshoot except this.

I think you are missing the CLI version. Please try:
npm i csso-cli
to install it.

Related

npm and other modules commands not working

Note: I am on Windows 10 64 bit running the latest LTS Node build.
It all started when I tried running the command npm i -g create-react-app and I get a message saying that npm is not a command.
I checked my PATH and I believe I have the proper directories in there.
I navigated to the directory of npm and tried running the command again, but it still didn't work. I found that the command npm.cmd worked in any directory. So tried running npm.cmd i -g create-react-app and that worked! I also had to use the the command create-react-app.cmd my-app, instead of create-react-app my-app. I thought I was set and I could just use those .cmd commands for the things I needed to do; however, when I tried to run the command create-react-app.cmd my-app and got this as a result:
I have looked in the file that is ran when using this command create-react-app.cmd my-app and there is no sign of npm being called. Turns out Node is being called in that file with the command below. I know this because when I run it by itself and I get the same output to the console seen in the previous image.
"node" "C:\Users\Allen\AppData\Roaming\npm\\node_modules\create-react-app\index.js" my-app
it was called in the create-react-app.cmd file like this "%_prog%" "%dp0%\node_modules\create-react-app\index.js" %*
I am at a loss. I could continue down this rabbit hole and try and find the node file that is calling npm and change it to npm.cmd but I would rather find a way to get the npm and create-react-app commands working as they are suppose to. At the very least I can just spin up a VM and work in that. It is just annoying that I can't get Node to work properly for me.
Use the command npx create-react-app my-app this will help you create react projects.
Also check the documentation : https://reactjs.org/
First check that you have npm installed on your machine and the version. You can just type npm version. Since npm version 5.2.0 npx is pre-bundled with npm, which is a CLI tool whose purpose is to make it easy to install and manage dependencies hosted in the npm registry. So try using npx create-react-app app-name. You can confirm that you are able to use npx by running which npx. If it is not available then you can install it by running npm install -g npx.

Contentful UI Extension Tutorial

I am trying to follow the UI Extensions Tutorial
At time code 02:36 I run the npm install && npm run login && npm run configure && npm run start command.
Afterwards I get the error: Cannot find module 'E:\Dev\Contentful\my-first-sidebar\node_modules\#contentful\contentful-extension-scripts\lib\index.js'.
I have globally re-installed the CLI and re-run the install/start command but still same error. I have also searched my hard drive for the contentful-extension-scripts\lib\ folder.
I see I have a contentful-extensions-scripts and contentful-extensions-scripts.cmd files and tried to run the cmd file but no use.
I am running on a Windows 10 box. Node version: 10.16.3​, Npm version: 6.9.0
UPDATE
I found the GitHub Repo for contentful-extensions-scripts, cloned it and copied over the folder but now I get the error: Cannot find module 'parcel-bundler' and I am out of my depth.
Add the following line to package.json to fix it:
"#contentful/contentful-extension-scripts": "^0.14.0".

What is the 'npm' command and how can I use it?

What is npm?
Whenever I browse through some project they ask me to run npm command, something like this
npm install -g node-windows
I went through some blog posts to learn about npm and I installed Node.js. However, when I run the above code in Node.js, I get the following errors:
When I browsed further, I came to know that the windows user can run the command from the cmd prompt window, but when I do that I get some output like this:
Which just generate a text file nothing else.
My questions:
How can I get started with the AngularJS2?
How can I run an npm command?
Do I require a command prompt to run the npm command (in Windows), or I can just use Node.js?
When I use the command npm install in my command prompt, I get the following output:
How to get started with the angularJS2
Follow this link and set up the project by following instructions
How to run a npm command
npm stands for Node Package Manager, and therefore you need Node.js installed before you can run npm commands.
Follow this and install the latest version. And restart the command prompt.
Do I require a command prompt to run npm commands (in Windows), or can I just use Node.js?
Yes, you need to run npm commands from the command line (in Windows).
E.g., npm install
You get the warning because there is no package.json file present where you are running the command.
ENOENT stands for Error NO ENTrey
Navigate to the project folder using the following command and then run npm install
cd <projectpath>
The AngularJS 2 website has everything you need to be covered. Their quickstart guide alongside with the quickseed zip file helps a lot.
But, in case you missed some points:
yes, you will need npm/NodeJS. So, download the latest distribution and have a clean installation of it.
you can execute the npm command with its parameters from within the Windows cmd.
the quickseed ZIP file contains all the files you need to see a live and quick example running locally. Unzip it on your workplace and navigate to it using the windows cmd. When inside the root folder of the unzipped package, execute npm install and right after it npm start.
Take the learning path. Step by step, all your questions will be answered.
You need to use an admin prompt for global installation (-g).

Setting the global NPM folder

So ultimately, I am trying to install gulp by following this tutorial http://travismaynard.com/writing/getting-started-with-gulp, and I was having a lot of problems initially. I kept getting the error that "gulp is not recognized as an internal or external command", which is confusing to me because I found that by running npm ls that gulp had been installed properly. The command wasn't being recognized even after restarting command prompt. I found an article online http://blog.webbb.be/command-not-found-node-npm/ that I may have installed gulp in my local folder other than the global node_module folder. However, when I tried to reset the npm folder with npm config set prefix usr/local/, I received errors. If anyone can walk me through getting the global NPM folder set up and getting the gulp command to work properly, that would be much appreciated.
Try running command prompt as administrator,
or sudo since you seem to be on unix,
you install a package globally by using npm -g,

Globally installed node-dev causes error "command not found"

So that I don't have to keep restarting node.js during development I'm trying to use node-dev. Unfortunately, when I try to run node-dev from terminal I receive the error:
$ node-dev server.js
-bash: node-dev: command not found
I have globally installed node-dev via the npm install node-dev -g command. The output from this command is:
npm http GET https://registry.npmjs.org/node-dev
npm http 304 https://registry.npmjs.org/node-dev
npm http GET https://registry.npmjs.org/growl
npm http 304 https://registry.npmjs.org/growl
/usr/local/share/npm/bin/node-dev -> /usr/local/share/npm/lib/node_modules/node-dev/node-dev
node-dev#0.2.9 /usr/local/share/npm/lib/node_modules/node-dev
└── growl#1.6.1
To be sure node-dev is installed globally I've run npm ls -g which returns:
/usr/local/share/npm/lib
└─┬ node-dev#0.2.9
└── growl#1.6.1
Some other posts have indicated that my globally installed npm modules should be in the /usr/local/lib/node_modules folder instead of /usr/local/share/npm/lib/. I can't tell if this is for older versions of npm or something that actually matters.
I'm new to both Mac OS X and Node development so it wouldn't surprise me that I was overlooking something trivial. What haven't I done which is causing me to get a "command not found" error when trying to utilize node-dev? Is there some sort of $PATH environment issue I'm overlooking?
One note I don't have Growl installed but the node-dev documentation indicated it was optional.
I think this could be your issue, and here's a walk-through to fixing it. It's specifically for WebStorm & Mocha, but seems like it could be related. I think you may need to setup an alias.
env: node: No such file or directory
Reason for this is that when running GUI applications under MacOSX,
the environment variables are not the same as those when you run a
from a terminal. In particular, node for instance is not on the path.
To overcome this issue, you can either launch WebStorm from the
terminal (yuck!) or solve it. Fortunately this isn’t as hard as it
once was. Here’s a Tip on our forum for RubyMine but it applies to all
IDE’s including WebStorm. In essence, its creating an
environment.plist file inside ~/.MacOSX which contains your full path.
Mine is here if you want to download it. Make sure you reboot your
machine after doing this step.
Setting up an alias
Everything should be working now, but instead of
having to type this in each time, lets set up an alias for it in
WebStorm. Click on Preferences (CMD+, under MacOSX) and type in
Command to get to the command line tools. Click on the + button to
create a new entry and confirm the dialog box to create a new custom
framework.

Resources