node:internal/modules/cjs/loader:927
throw err;
^
Error: Cannot find module './package.json'
Require stack:
- /usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/bin-prettier.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:996:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/bin-prettier.js:24:19)
at Module._compile (node:internal/modules/cjs/loader:1092:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
at Module.load (node:internal/modules/cjs/loader:972:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/bin-prettier.js'
]
Key bit: /usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/bin-prettier.js is trying to load ./package.json.
I'm not 100% confident on how relative requires work, but I think that means it wants /usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/package.json.
If I understand the gemspec, you intend to build the node_modules stuff locally then include them:
spec.files =
Dir.chdir(__dir__) do
%w[LICENSE bin/console package.json rubocop.yml] +
Dir['{{exe,lib,src}/**/*,*.md}'] +
Dir[
'node_modules/prettier/{index,bin-prettier,third-party,parser-*}.js'
]
end
And this doesn't appear to be including everything it needs.
I've managed to hack a random package.json into the tree, but I have no idea if it would get things functional because I just run into another missing file (doc.js).
When I run 1.6.0, I get this error:
Key bit:
/usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/bin-prettier.js
is trying to load./package.json
.I'm not 100% confident on how relative requires work, but I think that means it wants
/usr/local/bundle/gems/prettier-1.6.0/node_modules/prettier/package.json
.Which is not there:
If I understand the gemspec, you intend to build the
node_modules
stuff locally then include them:And this doesn't appear to be including everything it needs.
I've managed to hack a random
package.json
into the tree, but I have no idea if it would get things functional because I just run into another missing file (doc.js
).