importjs process not running when outside of react directory
jeffwillette opened this issue · 4 comments
this is probably a simple fix but I cannot see what is going on.
I installed the vim-import-js
plugin and added a line in my vimrc to run it on the save of javascript files.
au BufWritePre *.js :ImportJSFix
I then noticed that if I was outside of the react directory that I was working in, and I tried to edit a normal file with vim, I would get an error that says
importjs process not running
how is it finding or running the process from inside of the react project but not from the outside (I have installed importjs globally)
I had to brush up a little on how everything is setup, but after some twiddling I managed to reproduce things. I think the culprit is this:
⨠ importjs start < import-js/IMPORTJS
ImportJS (v2.6.0) DAEMON active. Logs will go to: /var/folders/1l/_t6tm7195nd53936tsvh2pc
r0000gn/T/importjs.log
/Users/henrictrotzig/import-js/build/findProjectRoot.js:20
throw new Error('No project root found, looking for a directory with a package.json f
ile.');
^
Error: No project root found, looking for a directory with a package.json file.
at findRecursive (/Users/henrictrotzig/import-js/build/findProjectRoot.js:20:11)
at findRecursive (/Users/henrictrotzig/import-js/build/findProjectRoot.js:29:10)
at findRecursive (/Users/henrictrotzig/import-js/build/findProjectRoot.js:29:10)
at findProjectRoot (/Users/henrictrotzig/import-js/build/findProjectRoot.js:41:10)
at Interface.<anonymous> (/Users/henrictrotzig/import-js/build/daemon.js:69:61)
at emitOne (events.js:96:13)
at Interface.emit (events.js:188:7)
at Interface._onLine (readline.js:219:10)
at Interface.<anonymous> (readline.js:352:12)
at Array.forEach (native)
→ exit status: 1
henrictrotzig@trotzig:~
⨠
(I followed instructions in the contributing document in case you want to do the same thing).
import-js wants a package root of some sort to know how to resolve imports. If it can't find one, it will complain with that error above.
I think we need to do something to make that error propagate to the client (it doesn't at the moment, leading to that incorrect error about process not running
). For now, I wonder if you could just silence the output?
actually now I am getting the error even when I am in a project directory, will edit with logs
==== start log session ====
0.424571 : Starting job: importjs start --parent-pid 40844
0.424678 on 0: Created channel
0.493111 : looking for messages on channels
1.878876 on 0: channel_select_check(): Read EOF from ch_part[1], closing
1.878907 RECV on 0: 'module.js:487
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/import-js/node_modules/sqlite3/lib/binding/node-v57-darwin-x64/node_sqlite3.node'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/import-js/node_modules/sqlite3/lib/sqlite3.js:4:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
'
1.878911 : looking for messages on channels
1.878920 on 0: Dropping message 'module.js:487
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/import-js/node_modules/sqlite3/lib/binding/node-v57-darwin-x64/node_sqlite3.node'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/import-js/node_modules/sqlite3/lib/sqlite3.js:4:15)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
'
1.878944 on 0: Job ended
1.879208 on 0: channel_select_check(): Read EOF from ch_part[2], closing
1.879221 : looking for messages on channels
1.879226 on 0: Closing channel because all readable fds are closed
1.879231 on 0: Closing channel
2.761864 : looking for messages on channels
10.470894 : ERROR: Error detected while processing function importjs#Fix[1]..importjs#ExecCommand:
10.470971 : ERROR: line 18:
10.471001 : ERROR: importjs process not running
10.471108 : looking for messages on channels
my last comment was my fault because I changed around the way vim works. everything seems to be working well now. closing