nodeless를 사용하여 간단한 Less 파일을 컴파일할 수 없습니다.

nodeless를 사용하여 간단한 Less 파일을 컴파일할 수 없습니다.

나는매우단순한더 적은Bootstrap만 포함된 파일:

/* application.less: The most awesomely complicated file in the whole world. */
@import "bootstrap/bootstrap.less";

저는 Ubuntu 12.04 파생 버전을 사용하고 있으며 패키지 lessc에 있는 컴파일러를 사용해 보았습니다 node-less.

$ sudo apt-get install node-less
...done!
$ ( cd /path/of/less/file/ && lessc application.less )
TypeError: Cannot call method 'charAt' of undefined
    at getLocation (/usr/lib/nodejs/less/parser.js:204:34)
    at new LessError (/usr/lib/nodejs/less/parser.js:213:19)
    at Object.toCSS (/usr/lib/nodejs/less/parser.js:379:31)
    at /usr/bin/lessc:103:28
    at /usr/lib/nodejs/less/parser.js:428:40
    at /usr/lib/nodejs/less/parser.js:94:48
    at /usr/lib/nodejs/less/index.js:113:15
    at /usr/lib/nodejs/less/parser.js:428:40
    at /usr/lib/nodejs/less/parser.js:94:48
    at /usr/lib/nodejs/less/index.js:113:15

쉽게 겁먹지 않기 위해 Ruby 버전의 lessc를 사용해 보았습니다.

$ sudo apt-get remove --purge node-less
$ sudo gem install less
...done!
[WARNING] Please install gem 'therubyracer' to use Less.
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- v8 (LoadError)
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/less-2.2.2/lib/less/java_script/v8_context.rb:2
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/less-2.2.2/lib/less/java_script.rb:9:in `default_context_wrapper'
    from /var/lib/gems/1.8/gems/less-2.2.2/lib/less/java_script.rb:17:in `context_wrapper'
    from /var/lib/gems/1.8/gems/less-2.2.2/lib/less/loader.rb:10:in `initialize'
    from /var/lib/gems/1.8/gems/less-2.2.2/lib/less.rb:14:in `new'
    from /var/lib/gems/1.8/gems/less-2.2.2/lib/less.rb:14
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
    from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /var/lib/gems/1.8/gems/less-2.2.2/bin/lessc:3
    from /usr/local/bin/lessc:19:in `load'
    from /usr/local/bin/lessc:19

서둘러요! Ruby는 종속성을 관리하는 방법을 모르시나요? ! 어느. 아름다운.

$ sudo gem install therubyracer
/usr/bin/ruby1.8 extconf.rb
checking for main() in -lpthread... yes
checking for v8.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-pthreadlib
    --without-pthreadlib
    --enable-debug
    --disable-debug
    --with-v8-dir
    --without-v8-dir
    --with-v8-include
    --without-v8-include=${v8-dir}/include
    --with-v8-lib
    --without-v8-lib=${v8-dir}/lib
/var/lib/gems/1.8/gems/therubyracer-0.11.0/ext/v8/build.rb:42:in `build_with_system_libv8': unable to locate libv8. Please see output for details (RuntimeError)
    from extconf.rb:22
    The Ruby Racer requires libv8 ~> 3.11.8
    to be present on your system in order to compile
    and link, but it could not be found.

    In order to resolve this, you will either need to manually
    install an appropriate libv8 and make sure that this
    build process can find it. If you install it into the
    standard system path, then it should just be picked up
    automatically. Otherwise, you'll have to pass some extra
    flags to the build process as a hint.

    If you don't want to bother with all that, there is a
    rubygem that will do all this for you. You can add
    following line to your Gemfile:
        gem 'libv8', '~> 3.11.8'

    We hope that helps, and we apologize, but now we have
    to push the eject button on this install.

    thanks,
    The Mgmt.

나는 끝났다. 당신은 가지고 있습니까?단순한얻다피복재내 배포판에 설치된 컴파일러 수가 더 적습니까? 정말 말도 안 돼요.

답변1

화면 이쪽:

 $ node --version
 v.0.8.16
 $ npm --version
 1.1.69
 $ npm install less
 npm http GET https://registry.npmjs.org/less
 npm http 200 https://registry.npmjs.org/less
 npm http GET https://registry.npmjs.org/less/-/less-1.3.3.tgz
 npm http 200 https://registry.npmjs.org/less/-/less-1.3.3.tgz
 npm http GET https://registry.npmjs.org/ycssmin
 npm http 200 https://registry.npmjs.org/ycssmin
 npm http GET https://registry.npmjs.org/ycssmin/-/ycssmin-1.0.1.tgz
 npm http 200 https://registry.npmjs.org/ycssmin/-/ycssmin-1.0.1.tgz
 [email protected] node_modules/less
 └── [email protected]
 $ ln --symbolic ~/node_modules/.bin/lessc ~/bin/lessc
 $ lessc --version
 lessc 1.3.3 (LESS Compiler) [JavaScript]

설치가 잘 작동합니다. 하지만 test.less파일을 실행할 수 없습니다( bootstrap설치되지 않음). 요약하자면: 왜 사용하지 않습니까 npm? node어떤 버전을 설치하셨나요?

답변2

@Deer Hunter의 많은 도움으로 저는 즉시 제품을 설치하고 실행할 수 있었습니다.

$ sudo apt-get install npm
$ sudo npm install --global less
$ sudo ln -s /usr/local/lib/node_modules/less/bin/lessc /usr/local/bin

관련 정보