I have googled and found many solutions but none work for me. I am using ionic2/cordova. Everything is installed properly: cordova, pug, pug-cli, ant, sdk, jdk.
Full Error Message:
'pug' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 6.3.9600 npm ERR! argv
"C:\Program Files(x86)\Nodist\v\nodev6.7.0\node.exe"
"C:\Program Files (x86)\Nodist \bin\node_modules\npm\bin\npmcli.js" "run" "pug" npm
ERR! node v6.7.0 npm ERR! npm v2.14.10 npm ERR! code ELIFECYCLE npmERR! Iwatch@ pug: `pug src/` npm ERR! Exit status 1 Full Error Message:
asked Jun 11, 2017 at 19:23
4
I had the same problem, searched for a solution and found this one it worked for me
For those searching to a solution for this but have already installed pug-cli, try specifying the version on installation. For example, npm install pug-cli@1.0.0-alpha1 -g
For some reason by default npm was installing version 0.0.0
answered Apr 28, 2019 at 9:18
1
For those having a problem with this on Linux distros in 2020, and are lead here by Google because pug isn’t downloading…
«pug» no longer is a thing; it is now «pug-cli». Install this with the usual npm package.
npm install pug-cli -g
answered Mar 17, 2020 at 16:07
bananabrannbananabrann
5467 silver badges25 bronze badges
If I translated and understood correctly, then you can’t use pug-cli. In windows, the installation via cmd solved the problem.
use cmd in windows
npm install pug-cli -g
answered May 24, 2022 at 18:26
npm-debug.log
0 info it worked if it ends with ok
1 verbose cli [ ‘D:Toolsnodejsnode.exe’,
1 verbose cli ‘D:Toolsnodejsnode_modulesnpmbinnpm-cli.js’,
1 verbose cli ‘install’,
1 verbose cli ‘pug’ ]
2 info using npm@3.10.10
3 info using node@v6.11.2
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData pug
8 silly fetchDirectoryPackageData pug
9 silly install normalizeTree
10 silly loadCurrentTree Finishing
11 silly loadIdealTree Starting
12 silly install loadIdealTree
13 silly cloneCurrentTree Starting
14 silly install cloneCurrentTreeToIdealTree
15 silly cloneCurrentTree Finishing
16 silly loadShrinkwrap Starting
17 silly install loadShrinkwrap
18 silly loadShrinkwrap Finishing
19 silly loadAllDepsIntoIdealTree Starting
20 silly install loadAllDepsIntoIdealTree
21 silly resolveWithNewModule pug-monorepo@ checking installable status
22 silly cache add args [ ‘pug’, null ]
23 verbose cache add spec pug
24 silly cache add parsed spec Result {
24 silly cache add raw: ‘pug’,
24 silly cache add scope: null,
24 silly cache add escapedName: ‘pug’,
24 silly cache add name: null,
24 silly cache add rawSpec: ‘pug’,
24 silly cache add spec: ‘D:Toolspug-toolpug’,
24 silly cache add type: ‘directory’ }
25 error addLocal Could not install D:Toolspug-toolpug
26 silly rollbackFailedOptional Starting
27 silly rollbackFailedOptional Finishing
28 silly runTopLevelLifecycles Finishing
29 silly install printInstalled
30 verbose stack Error: No version provided in package.json
30 verbose stack at D:Toolsnodejsnode_modulesnpmlibcacheadd-local.js:73:17
30 verbose stack at D:Toolsnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:356:5
30 verbose stack at checkBinReferences_ (D:Toolsnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:320:45)
30 verbose stack at final (D:Toolsnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:354:3)
30 verbose stack at then (D:Toolsnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:124:5)
30 verbose stack at D:Toolsnodejsnode_modulesnpmnode_modulesread-package-jsonread-json.js:311:12
30 verbose stack at D:Toolsnodejsnode_modulesnpmnode_modulesgraceful-fsgraceful-fs.js:78:16
30 verbose stack at tryToString (fs.js:456:3)
30 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
31 verbose cwd D:Toolspug-tool
32 error Windows_NT 6.1.7601
33 error argv «D:Toolsnodejsnode.exe» «D:Toolsnodejsnode_modulesnpmbinnpm-cli.js» «install» «pug»
34 error node v6.11.2
35 error npm v3.10.10
36 error No version provided in package.json
37 error If you need help, you may report this error at:
37 error https://github.com/npm/npm/issues
38 verbose exit [ 1, true ]
Возникла в первый раз проблема при установке мопса на чистую систему. Установил nodejs, использовал npm init. Ставлю пуг, проходит…распаковка(?) и в конце выбивает npm WARN name@1.0.0 No repository field.
Устанавливаю в папке Sites, Nodejs установлен туда же ( SitesNodejs) и там же ставится pug.
Вне зависимости от попыток сменить места расположения, установить глобально и т.д. — итог «pug» не является внутренней или внешней командой, исполняемой программой или пакетным файлом.»
Что можно попробовать сделать?
П.С. — в PATH прописан C:Users»username»AppDataRoamingnpm. Подозрительно.
-
Вопрос заданболее трёх лет назад
-
641 просмотр
Загрузка…
это потому, что pug-cli установлен локально и ./node_modules/.bin дирректория не включена в PATH вашего пользователя/системы.
можете вызвать вот так:
Код
node ./node_modules/.bin/pug --help
если, например, использовать IDE WebStorm, то терминал который включен в IDE автоматически подтянет ./node_modules/.bin
дирректорию в PATH и можно будет вызывать pug команду без использования способа выше.
Если же вам нужно использовать одну и ту же команду для, например, компеляции, то её можно указать в package.json в scripts
Код
"scripts": { "build-pug": "pug --help" }
и затем запускать используя npm:
это работает т.к. под капотом npm лезет в ./node_modules/.bin дирректорию и исполняет данную команду как в способе выше…