alexanderweiss / nova-prettier

Prettier extension for Nova
MIT License
35 stars 6 forks source link

Unable to use the standalone Prettier #29

Closed jjshammas closed 4 years ago

jjshammas commented 4 years ago

Wanted to test out this plugin on fresh files, but can't get it to start with the standalone version. This is in the console:

Unable to set up prettier service Error: Could not find a module at path: “../../../../../../../../Users/john/Library/Application Support/Nova/Extensions/alexanderweiss.prettier/node_modules/prettier/standalone.js” [native code]
load@file:///Users/john/Library/Application%20Support/Nova/Extensions/alexanderweiss.prettier/Scripts/prettier.js:65:20
file:///Users/john/Library/Application%20Support/Nova/Extensions/alexanderweiss.prettier/Scripts/prettier.js:104:16
asyncFunctionResume@[native code]
[native code]
promiseReactionJobWithoutPromise@[native code]
promiseReactionJob@[native code]

Plugin version 1.6.1. Navigating to that folder, there is nothing at all in the node_modules. I also see this error:

Unable to find or install prettier Error: npm WARN alexanderweiss.prettier No repository field.
npm WARN alexanderweiss.prettier No license field.

npm ERR! Cannot read property 'resolve' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/john/.npm/_logs/2020-10-07T17_58_49_495Z-debug.log file:///Users/john/Library/Application%20Support/Nova/Extensions/alexanderweiss.prettier/Scripts/main.js:46:49

Here's the fuller stack trace from the debug log:

133 verbose stack TypeError: Cannot read property 'resolve' of undefined
133 verbose stack     at regFetch (/usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/index.js:76:23)
133 verbose stack     at fromManifest (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/tarball.js:55:3)
133 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/tarball.js:38:25
133 verbose stack     at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
133 verbose stack     at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)
133 verbose stack     at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)
133 verbose stack     at Promise._settlePromiseCtx (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:611:10)
133 verbose stack     at _drainQueueStep (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:142:12)
133 verbose stack     at _drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
133 verbose stack     at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
133 verbose stack     at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
133 verbose stack     at processImmediate (internal/timers.js:439:21)

I tried node version 13, 12, and 10 (10 has a different TypeError), but can't seem to get anything to work.

alexanderweiss commented 4 years ago

This seems to be a node issue. Looks similar to this problem: https://github.com/nodejs/help/issues/1941, for which the solution seems to be reinstalling Node. You could try running npm install in the extension folder and see what happens, because that appears to be failing. If that works, you should look at your login shell (which is what Nova extension use): https://library.panic.com/nova/environment-variables/

jjshammas commented 4 years ago

Thanks @alexanderweiss, you are correct! Interesting that this only popped up with this extension, but either way, I was actually able to fix it by uninstalling and re-installing n, and then switching node versions again.