Giter VIP home page Giter VIP logo

Comments (8)

alexdima avatar alexdima commented on September 28, 2024

It looks like npm install . failed to compile the native node module oniguruma?

Here are the steps to get the C++ toolchain installed on your machine:

https://github.com/nodejs/node-gyp#installation

from vscode-textmate.

hoovercj avatar hoovercj commented on September 28, 2024

I've done this and it still didn't work. A little more research makes me think the issue is that I have x64 node? I'll try running npm install to compile it with x86 node later and see if that helps.

from vscode-textmate.

alexdima avatar alexdima commented on September 28, 2024

Yeah, especially if you use nvm or you have recently switched node versions, it is possible that you have compiled the native node module for the wrong node version. I suggest to do a git clean -xfd (will remove everything as if you cloned fresh!) in vscode-textmate and run again npm install .. You can then monitor the output and see what the C++ compilation is doing.

from vscode-textmate.

hoovercj avatar hoovercj commented on September 28, 2024

What node version should I be using? I tried 32-bit versions of 6.6.0 and 6.3.0 and I got a different error. I'm not sure if it is a step forward or backward:

Error: A dynamic link library (DLL) initialization routine failed.\r\n\\?\c:\path\to\extension\node_modules\vscode-textmate\node_modules\oniguruma\build\Release\onig_scanner.node

from vscode-textmate.

alexdima avatar alexdima commented on September 28, 2024

@hoovercj Can you please start fresh. All the messages you are getting indicate (from me googling them) that the native node module got somehow built for the wrong node version target.

Do it all inside one console without closing it in between the steps (to be certain to get the same environment).

  • step1: git clone https://github.com/Microsoft/vscode-textmate.git
  • step2: cd vscode-textmate
  • step3: npm install .
  • step4: npm run compile
  • step5: npm run test

If this does not work, please post in here all the output you get at each step and then we can go ask the node-gyp folks for further guidance.

from vscode-textmate.

hoovercj avatar hoovercj commented on September 28, 2024

Yes, I can try that tonight and let you know. Thanks!

What I'm trying to do, though, is use vscode-textmate in my own vscode extension until a proper API surfaces token information.

To accomplish that, do I need to do the steps above and copy it over to my extension? Because simply adding vscode-textmate to my extension's package.json isn't working.

from vscode-textmate.

alexdima avatar alexdima commented on September 28, 2024

Oh, finally the errors you're getting make sense ! ;)

In VSCode the runtime is not node, but electron. Therefore, you would need to compile oniguruma (the native dependency of vscode-textmate against the exact same electron version as VSCode ships with.

In stable/1.5.x that would be electron v0.37.6 and in insiders/1.6.x electron v1.3.5

For insiders/1.6.x Windows (from me looking at vscode's script\npm.bat) the following environmental variables would be needed to get node-gyp to compile against the same electron version as VSCode:

set npm_config_disturl="https://atom.io/download/atom-shell"
set npm_config_target=1.3.5
set npm_config_arch="ia32"
set npm_config_runtime="electron"
set HOME=~\.electron-gyp
:: Now you can use npm
npm install .

That being said, you would need to compile vscode-textmate's oniguruma on Windows, Mac and Linux 32/64 bit to get your extension working across all OSes. And you would need to implement some switching loading logic on your side, as node's require will not do that for you out of the box.

If I were you, I'd try loading the vscode-textmate that already ships with vscode (the OS problem is solved). It is pretty black-magic, but you could load it via:

var tm = require(path.join(require.main.filename, '../../node_modules/vscode-textmate/release/main.js'));

from vscode-textmate.

hoovercj avatar hoovercj commented on September 28, 2024

Great, thanks! This seems to be working now.

Just as an added note in case anybody else finds this, I'm trying to use this in a language server extension so I have to evaluate require.main.filename in the language client and pass it over with the initializationOptions to get the right value.

from vscode-textmate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.