D
D
Daniel Pasko2018-02-07 16:29:16
Windows
Daniel Pasko, 2018-02-07 16:29:16

Error when installing packages via npm?

The goal is simple - to typeset, collect everything, for example, through gulp or webpack and so on.
My actions:
1. Installed node.js from the site to the default folder C:\Program Files\nodejs
2. I open the console, write " npm config list " and get in response

C:\Users\User>npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/5.6.0 node/v8.9.4 win32 x64"

; userconfig C:\Users\User\.npmrc
prefix = "C:\\Users\\User\\.node_modules_global"

; builtin config undefined

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users\User
; HOME = C:\Users\User
; "npm config ls -l" to show all defaults.
.
3. Install stylus globally: " npm install stylus -g ". In response I get:
C:\Users\User>npm install stylus -g
C:\Users\User\.node_modules_global\stylus -> C:\Users\User\.node_modules_global\node_modules\stylus\bin\stylus
+ [email protected]
added 20 packages in 1.895s

4. I check that it is installed globally:
C:\Users\User>npm list -g --depth=0
C:\Users\User\.node_modules_global
`-- [email protected]

5. Through cd I go to the directory that I want to use as a working one. For example, D:\work\projects\test
6. I create a style file main.styl and try to convert it to css when changed via "stylus -w" and get the following:
D:\work\projects\test>stylus -w main.styl -o style.css
"stylus" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.

Completely similar situation, for example, with less. Tried also uglify-js - same thing.
Please specify exactly what is wrong, if possible.
Thank you in advance.
UPD_1.0
Stylus works if you go to the folder with this module via cd and run it from there:
C:\Users\User\.node_modules_global>stylus main.styl -o main.css --compress
  compiled main.css

At local installation the same effect - works. But this is not supposed to work like that :) Why then does the global installation exist at all?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
RidgeA, 2018-02-07
@Daniel_April

So write cmd stilys in PATH. But it is not exactly...

E
Egor Zhivagin, 2018-02-07
@Krasnodar_etc

What happens if you put it not globally, but in the right folder?

S
skoval, 2018-02-07
@skoval

It will be that we all don’t know what will happen) so try to put it in the right folder, and then unsubscribe, we will all know what the outcome of your actions was. Otherwise, it's best to use Gulp instead - it's yesterday's technology, just like webpack, only uneducated front-enders use it. Use Jiga rts, good documentation, easy to install, + not as buggy as galp and webpack. It uses a new transpiler, a software compiler at the C++ level and above.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question