Geben Sie zurück, dass das Verzeichnis unter Windows nicht als interner oder externer Befehl erkannt wird

436
jcubic

Ich habe ein Projekt, das make macht, das normalerweise unter GNU / Linux läuft, und jetzt habe ich versucht, es unter Windows auszuführen und bekam einen Fehler (von git bash):

'.' is not recognized as an internal or external command, 

Ich habe den Punkt vor node_modules entfernt und dann habe ich die Fehlermeldung bekommen, dass node_modules nicht erkannt wird. node_modules wurde in meinem Verzeichnis erstellt, als ich npm install ausgeführt habe.

Ich habe sowohl die MinGW- als auch die GNUWin-Version ausprobiert, und beide geben denselben Fehler zurück. Das Projekt funktionierte beim letzten Mal, als ich es vor etwa einem Jahr unter Windows lief.

Hier ist mein Makefile, das scheitert:

VERSION=1.16.1 SED=sed CD=cd NPM=npm CP=cp RM=rm CAT=cat DATE=`date -uR` GIT=git BRANCH=`git branch | grep '^*' | sed 's/* //'` ESLINT=node_modules/.bin/eslint UGLIFY=node_modules/.bin/uglifyjs JSONLINT=node_modules/.bin/jsonlint JEST=node_modules/.bin/jest CSSNANO=./node_modules/.bin/cssnano SPEC_CHECKSUM=`md5sum __tests__/terminalSpec.js | cut -d' ' -f 1` COMMIT=`git log -n 1 | grep commit | sed 's/commit //'` URL=`git config --get remote.origin.url` skip_re="[xfi]it\\(|[fdx]describe\\("  .PHONY: coverage test coveralls lint.src eslint skipped_tests jsonlint publish lint  ALL: Makefile .$(VERSION) terminal.jquery.json bower.json package.json js/jquery.terminal-$(VERSION).js js/jquery.terminal.js js/jquery.terminal-$(VERSION).min.js js/jquery.terminal.min.js css/jquery.terminal-$(VERSION).css css/jquery.terminal-$(VERSION).min.css css/jquery.terminal.min.css css/jquery.terminal.css README.md import.html js/terminal.widget.js www/Makefile  foo: echo `pwd`  bower.json: templates/bower.in .$(VERSION) $(SED) -e "s/{}/$(VERSION)/g" templates/bower.in > bower.json  package.json: templates/package.in .$(VERSION) $(SED) -e "s/{}/$(VERSION)/g" templates/package.in > package.json  js/jquery.terminal-$(VERSION).js: js/jquery.terminal-src.js .$(VERSION) $(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{}/DEV/g" -e "s/{}/$(DATE)/g" js/jquery.terminal-src.js > js/jquery.terminal-$(VERSION).js || $(SED) -e "s/{}/$(VERSION)/g" -e "s/{}/$(DATE)/g" js/jquery.terminal-src.js > js/jquery.terminal-$(VERSION).js  js/jquery.terminal.js: js/jquery.terminal-$(VERSION).js $(CP) js/jquery.terminal-$(VERSION).js js/jquery.terminal.js  js/jquery.terminal-$(VERSION).min.js: js/jquery.terminal-$(VERSION).js $(UGLIFY) -o js/jquery.terminal-$(VERSION).min.js --comments --mangle -- js/jquery.terminal-$(VERSION).js  js/jquery.terminal.min.js: js/jquery.terminal-$(VERSION).min.js $(CP) js/jquery.terminal-$(VERSION).min.js js/jquery.terminal.min.js  css/jquery.terminal-$(VERSION).css: css/jquery.terminal-src.css .$(VERSION) $(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{}/DEV/g" -e "s/{}/$(DATE)/g" css/jquery.terminal-src.css > css/jquery.terminal-$(VERSION).css || $(SED) -e "s/{}/$(VERSION)/g" -e "s/{}/$(DATE)/g" css/jquery.terminal-src.css > css/jquery.terminal-$(VERSION).css  css/jquery.terminal.css: css/jquery.terminal-$(VERSION).css .$(VERSION) $(CP) css/jquery.terminal-$(VERSION).css css/jquery.terminal.css  css/jquery.terminal.min.css: css/jquery.terminal-$(VERSION).min.css $(CP) css/jquery.terminal-$(VERSION).min.css css/jquery.terminal.min.css  css/jquery.terminal-$(VERSION).min.css: css/jquery.terminal-$(VERSION).css $(CSSNANO) css/jquery.terminal-$(VERSION).css css/jquery.terminal-$(VERSION).min.css --no-discardUnused --safe  README.md: templates/README.in .$(VERSION) $(GIT) branch | grep '* devel' > /dev/null && $(SED) -e "s/{}/DEV/g" -e \ "s/{}/$(BRANCH)/g" -e "s/{}/$(SPEC_CHECKSUM)/" \ -e "s/{}/$(COMMIT)/g" < templates/README.in > README.md || $(SED) -e \ "s/{}/$(VERSION)/g" -e "s/{}/$(BRANCH)/g" -e \ "s/{}/$(SPEC_CHECKSUM)/" -e "s/{}/$(COMMIT)/g" < templates/README.in > README.md  .$(VERSION): Makefile touch .$(VERSION)  Makefile: templates/Makefile.in $(SED) -e "s/{}/"$(VERSION)"/" templates/Makefile.in > Makefile  import.html: templates/import.in $(SED) -e "s/{}/$(BRANCH)/g" templates/import.in > import.html  js/terminal.widget.js: js/terminal.widget.in $(GIT) branch | grep '* devel' > /dev/null || $(SED) -e "s/{}/$(VERSION)/g" js/terminal.widget.in > js/terminal.widget.js  terminal.jquery.json: manifest .$(VERSION) $(SED) -e "s/{}/$(VERSION)/g" manifest > terminal.jquery.json  www/Makefile: $(wildcard www/Makefile.in) Makefile .$(VERSION) @test "$(BRANCH)" = "master" -a -d www && $(SED) -e "s/{}/$(VERSION)/g" www/Makefile.in > www/Makefile || true  test: $(JEST) --coverage --collectCoverageFrom=js/.js  coveralls: $(CAT) ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js  lint.src: $(ESLINT) js/jquery.terminal-src.js  eslint: $(ESLINT) js/jquery.terminal-src.js $(ESLINT) js/dterm.js $(ESLINT) js/xml_formatting.js $(ESLINT) js/unix_formatting.js $(ESLINT) js/prims.js $(ESLINT) js/less.js  skipped_tests: @! grep -E $(skip_re) __tests__/terminalSpec.js  jsonlint: package.json bower.json $(JSONLINT) package.json > /dev/null $(JSONLINT) bower.json > /dev/null  publish: $(GIT) clone $(URL) --depth 1 npm $(CD) npm && $(NPM) publish $(RM) -rf npm  lint: eslint jsonlint 

Lass das richtige Verzeichnis zurückkehren.

Das Problem ist diese Regel:

UGLIFY=./node_modules/.bin/uglifyjs  js/jquery.terminal-$(VERSION).min.js: js/jquery.terminal-$(VERSION).js $(UGLIFY) -o js/jquery.terminal-$(VERSION).min.js --comments --mangle -- js/jquery.terminal-$(VERSION).js 

Aber wenn ich den Befehl aus demselben Verzeichnis in gitbash ausführte, wurde er erfolgreich ausgeführt. Ich habe auch versucht, den Exportpfad PATH =.: $ PATH vor dem Ausführen von make auszuführen und erhielt den gleichen Fehler.

Ich habe auch versucht, das Zeilenende von Makefile von Unix auf Windows zu ändern, aber das Problem wurde auch nicht gelöst.

0

1 Antwort auf die Frage

0
jcubic

Das Problem war ein Schrägstrich gegen einen Backslash. Die Lösung besteht also darin, einen anderen Pfad für Windows und Linux zu verwenden:

ifdef SYSTEMROOT UGLIFY=.\node_modules\.bin\uglifyjs JSONLINT=.\node_modules\.bin\jsonlint JEST=.\node_modules\.bin\jest CSSNANO=.\node_modules\.bin\cssnano ESLINT=.\node_modules\.bin\eslint else UGLIFY=./node_modules/.bin/uglifyjs JSONLINT=./node_modules/.bin/jsonlint JEST=./node_modules/.bin/jest CSSNANO=./node_modules/.bin/cssnano ESLINT=./node_modules/.bin/eslint endif