facebookarchive / nuclide

An open IDE for web and native mobile development, built on top of Atom
https://nuclide.io
Other
7.79k stars 682 forks source link

Remote Terminal shows cannot find module, but can edit the file system. #1431

Open VinayakBagaria opened 6 years ago

VinayakBagaria commented 6 years ago

Issue and Steps to Reproduce

I am not able to open terminal when connected to a remote server via Nuclide. Although, I can edit the files and those changes do reflect in the remote file.

Try connecting to a remote directory. Select 'New Terminal Here' from the Context Menu. It shows : screenshot from 2018-01-04 21-38-02

Expected Behavior

Terminal should open, which allows remote command line interfacing.

Actual Behavior

See response in the image above. Nuclide installs pty-v0.0.2-node-v51-linux-x64 as a directory in remote environment.

Versions

Additional Details

DanielKristofKiss commented 6 years ago

I got the same:

TheBirdie commented 6 years ago

Same with;

TheBirdie commented 6 years ago

I've got a workaround if anyone is interested:

  1. Clone pty repo (https://github.com/chjj/pty.js)
  2. cd pty && npm install
  3. Create the folder missing from your error message (... ... nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty-v0.0.2-node-v59-linux-x64 for me)
  4. Copy inside the binary generated in step (2) (pty.js/build/Release/pty.node)

.. or using an old NodeJS version corresponding to the ABI version 51 should work as well (see here https://nodejs.org/en/download/releases/)

tim-soft commented 6 years ago

I'm also hitting this wall! It looks like the remote terminal function relies on a package that doesn't exist.

Error starting process:
    Error: Remote Error: Cannot find module '/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty-v0.1.2-node-v59-linux-x64/pty.node'
processing message {
    "protocol": "service_framework3_rpc",
    "type": "call",
    "method": "PtyService/spawn",
    "id": 26,
    "args": {
        "info": {
            "terminalType": "xterm-256color",
            "environment": [],
            "cwd": "/srv/node/my-remote-project"
        },
        "client": -6
    }
}

Jumping into node_modules/nuclide-prebuilt-libs/pty/build It seems like these other builds of pty were made just fine?

pty-v0.0.2-node-v57-darwin-x64       pty-v0.1.2-electron-v1.6-win32-x64   pty-v0.1.2-node-v51-darwin-x64
pty-v0.1.0-node-v57-darwin-x64       pty-v0.1.2-electron-v1.7-darwin-x64  pty-v0.1.2-node-v51-linux-x64
pty-v0.1.2-electron-v1.6-darwin-x64  pty-v0.1.2-electron-v1.7-linux-x64   pty-v0.1.2-node-v51-win32-x64
pty-v0.1.2-electron-v1.6-linux-x64   pty-v0.1.2-electron-v1.7-win32-x64
Error: Cannot Find Module

```bash Error: Cannot find module '/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty-v0.1.2-node-v59-linux-x64/pty.node' at Function.Module._resolveFilename (module.js:557:15) at Function.Module._load (module.js:484:25) at Module.require (module.js:606:17) at require (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at Object. (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/lib/unixTerminal.js:17:11) at Module._compile (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/v8-compile-cache/v8-compile-cache.js:178:30) at Object.Module._extensions..js (module.js:673:10) at Module.load (module.js:575:32) at tryModuleLoad (module.js:515:12) at Function.Module._load (module.js:507:3) at Module.require (module.js:606:17) at require (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at Object. (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/lib/index.js:9:16) at Module._compile (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/v8-compile-cache/v8-compile-cache.js:178:30) at Object.Module._extensions..js (module.js:673:10) at Module.load (module.js:575:32) at tryModuleLoad (module.js:515:12) at Function.Module._load (module.js:507:3) at Module.require (module.js:606:17) at require (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) at _load_pty (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/pkg/nuclide-pty-rpc/lib/PtyService.js:170:41) at new PtyImplementation (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/pkg/nuclide-pty-rpc/lib/PtyService.js:236:38) at RpcConnection. (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/pkg/nuclide-pty-rpc/lib/PtyService.js:23:12) at Generator.next () at step (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/async-to-generator/async-to-generator.js:11:30) at _next (/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/async-to-generator/async-to-generator.js:24:9) at ```

Following @TheBirdie 's advice, I built my own version from source.

# Get pty src
git clone https://github.com/chjj/pty.js.git
cd pty.js/

# Build pty
yarn install

# Make missing dir from error, in my case /pty-v0.1.2-node-v59-linux-x64
mkdir /root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty-v0.1.2-node-v59-linux-x64

# Copy pty build to error dir
cp ./build/Release/pty.node /root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty-v0.1.2-node-v59-linux-x64/pty.node 
Building pty throws some deprecation warnings

```bash $ node-gyp rebuild [####################--------------] 20/34gyp info it worked if it ends with ok gyp info using node-gyp@3.6.2 gyp info using node@9.6.1 | linux | x64 gyp info spawn /usr/bin/python2 gyp info spawn args [ '/root/.nvm/versions/node/v9.6.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', gyp info spawn args 'binding.gyp', gyp info spawn args '-f', gyp info spawn args 'make', gyp info spawn args '-I', gyp info spawn args '/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty.js/build/config.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.nvm/versions/node/v9.6.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', gyp info spawn args '-I', gyp info spawn args '/root/.node-gyp/9.6.1/include/node/common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=/root/.node-gyp/9.6.1', gyp info spawn args '-Dnode_gyp_dir=/root/.nvm/versions/node/v9.6.1/lib/node_modules/npm/node_modules/node-gyp', gyp info spawn args '-Dnode_lib_file=/root/.node-gyp/9.6.1/<(target_arch)/node.lib', gyp info spawn args '-Dmodule_root_dir=/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty.js', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'build', gyp info spawn args '-Goutput_dir=.' ] gyp info spawn make gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] make: Entering directory '/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty.js/build' CXX(target) Release/obj.target/pty/src/unix/pty.o In file included from ../node_modules/nan/nan.h:190:0, from ../src/unix/pty.cc:20: ../node_modules/nan/nan_maybe_43_inl.h: In function ‘Nan::Maybe Nan::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’: ../node_modules/nan/nan_maybe_43_inl.h:88:64: warning: ‘v8::Maybe v8::Object::ForceSet(v8::Local, v8::Local, v8::Local, v8::PropertyAttribute)’ is deprecated: Use CreateDataProperty / DefineOwnProperty [-Wdeprecated-declarations] return obj->ForceSet(GetCurrentContext(), key, value, attribs); ^ In file included from /root/.node-gyp/9.6.1/include/node/v8.h:26:0, from /root/.node-gyp/9.6.1/include/node/node.h:63, from ../node_modules/nan/nan.h:47, from ../src/unix/pty.cc:20: /root/.node-gyp/9.6.1/include/node/v8.h:3165:29: note: declared here Maybe ForceSet(Local context, Local key, ^ /root/.node-gyp/9.6.1/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’ declarator __attribute__((deprecated(message))) ^ ../src/unix/pty.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE PtyFork(Nan::NAN_METHOD_ARGS_TYPE)’: ../src/unix/pty.cc:222:34: warning: ignoring return value of ‘int chdir(const char*)’, declared with attribute warn_unused_result [-Wunused-result] if (strlen(cwd)) chdir(cwd); ^ SOLINK_MODULE(target) Release/obj.target/pty.node COPY Release/pty.node make: Leaving directory '/root/.nvm/versions/node/v9.6.1/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/build/pty.js/build' gyp info ok Done in 3.23s. ```

After all that, the remote terminal seems to be working just fine, despite all of the pty deprecation warnings.

The reason this happens:

for this package we've only prebuilt binaries for Node versions corresponding to Electron versions corresponding to Atom versions (Phew!) Currently Atom 1.23/1.24 correspond to Node 7.4.0, and Atom 1.25 corresponds to Node 7.9.0, both of which are covered by this package.

If you aren't using a supported version of node, the nuclide prebuilt libs may not contain useable binaries for you.

paulchill commented 6 years ago

is this fixed?

rwatts3 commented 6 years ago

having the same issue, and it's been this way for at least a month, just curious if there is a solution.

shrey150 commented 6 years ago

I ran "Application: Install Update" from Atom and this error started occurring and I'm having problems with doing the workaround, is there a definitive solution to this?

leoroh commented 6 years ago

same here. Node version is 6.9.1 and atom 1.28

dotku commented 6 years ago

I manually download the pty version from here https://github.com/daviwil/node-pty-prebuilt

then I got error with function:

Error starting process:
Error: Remote Error: Usage: pty.fork(file, args, env, cwd, cols, rows, uid, gid, utf8, onexit) processing message {"protocol":"service_framework3_rpc","type":"call","method":"PtyService/spawn","id":27,"args":{"info":{"terminalType":"xterm-256color","environment":[],"cwd":"/usr/share/nginx/react-es/"},"client":-4}}
"Error: Usage: pty.fork(file, args, env, cwd, cols, rows, uid, gid, utf8, onexit)\n    at new UnixTerminal (/home/ec2-user/.nvm/versions/node/v10.11.0/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/lib/unixTerminal.js:53:24)\n    at Object.spawn (/home/ec2-user/.nvm/versions/node/v10.11.0/lib/node_modules/nuclide/node_modules/nuclide-prebuilt-libs/pty/lib/index.js:12:12)\n    at new PtyImplementation (/home/ec2-user/.nvm/versions/node/v10.11.0/lib/node_modules/nuclide/modules/atom-ide-ui/pkg/atom-ide-terminal/lib/pty-service/PtyService.js:247:42)\n    at RpcConnection.spawn (/home/ec2-user/.nvm/versions/node/v10.11.0/lib/node_modules/nuclide/modules/atom-ide-ui/pkg/atom-ide-terminal/lib/pty-service/PtyService.js:120:10)"