atom / language-python

Python package for Atom
Other
190 stars 146 forks source link

Failed to load a language-python package grammar #310

Closed chbk closed 5 years ago

chbk commented 5 years ago

I would love to help improve the tree-sitter grammar, but I'm having some difficulties setting up a fork. Before tree-sitter, I could make changes to a language package by:

  1. forking
  2. cloning: git clone forked-package
  3. linking: apm link forked-package
  4. coding and testing

By following these steps, I now get the following error:

Failed to load a language-python package grammar

Cannot find module 'tree-sitter-python' in /Users/chbk/.atom/packages/language-python/grammars/tree-sitter-python.cson

At this point I figured I needed the tree-sitter-python node module, so I attempted to install it with npm install tree-sitter-python and I get this error:

> tree-sitter-python@0.15.0 install /Users/chbk/projects/language-python/node_modules/tree-sitter-python
> node-gyp rebuild

  CC(target) Release/obj.target/tree_sitter_python_binding/src/parser.o
  CXX(target) Release/obj.target/tree_sitter_python_binding/src/binding.o
../src/binding.cc:13:6: error: variable has incomplete type 'void'
void Init(Handle<Object> exports, Handle<Object> module) {
     ^
../src/binding.cc:13:11: error: use of undeclared identifier 'Handle'
void Init(Handle<Object> exports, Handle<Object> module) {
          ^
../src/binding.cc:13:18: error: 'Object' does not refer to a value
void Init(Handle<Object> exports, Handle<Object> module) {
                 ^
/Users/chbk/Library/Caches/node-gyp/12.9.1/include/node/v8.h:3369:17: note: 
      declared here
class V8_EXPORT Object : public Value {
                ^
../src/binding.cc:13:26: error: use of undeclared identifier 'exports'
void Init(Handle<Object> exports, Handle<Object> module) {
                         ^
../src/binding.cc:13:35: error: use of undeclared identifier 'Handle'
void Init(Handle<Object> exports, Handle<Object> module) {
                                  ^
../src/binding.cc:13:42: error: 'Object' does not refer to a value
void Init(Handle<Object> exports, Handle<Object> module) {
                                         ^
/Users/chbk/Library/Caches/node-gyp/12.9.1/include/node/v8.h:3369:17: note: 
      declared here
class V8_EXPORT Object : public Value {
                ^
../src/binding.cc:13:50: error: use of undeclared identifier 'module'
void Init(Handle<Object> exports, Handle<Object> module) {
                                                 ^
../src/binding.cc:13:57: error: expected ';' after top level declarator
void Init(Handle<Object> exports, Handle<Object> module) {
                                                        ^
                                                        ;
8 errors generated.
make: *** [Release/obj.target/tree_sitter_python_binding/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:196:23)
gyp ERR! stack     at ChildProcess.emit (events.js:209:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/Cellar/node/12.9.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/chbk/projects/language-python/node_modules/tree-sitter-python
gyp ERR! node -v v12.9.1
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! tree-sitter-python@0.15.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the tree-sitter-python@0.15.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/chbk/.npm/_logs/2019-09-02T18_48_38_064Z-debug.log

I'm on macOS 10.14.6 What am I doing wrong?

rsese commented 5 years ago

Hey @chbk!

This seems like an issue with tree-sitter-python and I see you opened an issue in that repository :+1: I think the maintainers there will be able help with the error you're seeing (I wonder if it's related to Node 12? I've seen other Tree-sitter repositories with Node 12 issues I think).

In general though, the best places for questions like this are the Atom Slack and maybe the official message board. We try to keep the issues list as much as possible to tasks needing to be completed so we'll close this for now but if you find a specific problem with language-python, please let us know.