benrbray / remark-cite

Adds support for pandoc-style citations to the Markdown syntax for the remark and micromark parsers.
MIT License
20 stars 5 forks source link

Installing Dependencies With Yarn Failing (...for me at least) #4

Closed manunamz closed 1 month ago

manunamz commented 2 years ago

First off, thanks for the project. Hat tip for the tidiness. 🎩

I'm not sure if there is just something off with my environment, but it might be an opportunity to tidy even further. 🧹


These are the steps I went through getting this project setup to run locally:

  1. a) At the root level, I tried:

$ yarn install

  1. b) Which yielded this output three times, once for each of the three subprojects:
yarn run v1.22.18
warning ../../../package.json: No license field
$ npm run test:micromark-extension-cite; npm run test:mdast-util-cite; npm run test:remark-cite

> test:micromark-extension-cite
> cd micromark-extension-cite && npm run test

> @benrbray/micromark-extension-cite@1.0.0 pretest
> npm run clean; npm run build

> @benrbray/micromark-extension-cite@1.0.0 clean
> npx del dist

npm ERR! could not determine executable to run

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2022-06-23T14_22_45_734Z-debug-0.log

> @benrbray/micromark-extension-cite@1.0.0 build
> rollup -c

[!] Error: Cannot find module '@wessberg/rollup-plugin-ts'
Require stack:
- /Users/user/code/ref/remark-cite/micromark-extension-cite/rollup.config.js
- /opt/homebrew/lib/node_modules/rollup/dist/shared/loadConfigFile.js
- /opt/homebrew/lib/node_modules/rollup/dist/bin/rollup
Error: Cannot find module '@wessberg/rollup-plugin-ts'
Require stack:
- /Users/user/code/ref/remark-cite/micromark-extension-cite/rollup.config.js
- /opt/homebrew/lib/node_modules/rollup/dist/shared/loadConfigFile.js
- /opt/homebrew/lib/node_modules/rollup/dist/bin/rollup
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/user/code/ref/remark-cite/micromark-extension-cite/rollup.config.js:6:10)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.require.extensions.<computed> [as .js] (/opt/homebrew/lib/node_modules/rollup/dist/shared/loadConfigFile.js:614:20)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
  1. I decided to try running the install within each of the 3 subprojects individually:
yarn install v1.22.18
warning ../../../../package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
$ npm run clean; npm run build

> @benrbray/mdast-util-cite@1.1.0 clean
> npx del dist

> @benrbray/mdast-util-cite@1.1.0 build
> rollup -c

[!] Error: Cannot find module 'typescript'
Require stack:
- /Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/@wessberg/rollup-plugin-ts/dist/cjs/index.js
- /Users/user/code/ref/remark-cite/mdast-util-cite/rollup.config.js
- /Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/rollup/dist/shared/loadConfigFile.js
- /Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/rollup/dist/bin/rollup
Error: Cannot find module 'typescript'
Require stack:
- /Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/@wessberg/rollup-plugin-ts/dist/cjs/index.js
- /Users/user/code/ref/remark-cite/mdast-util-cite/rollup.config.js
- /Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/rollup/dist/shared/loadConfigFile.js
- /Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/rollup/dist/bin/rollup
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/@wessberg/rollup-plugin-ts/dist/cjs/index.js:11:16)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .js] (/Users/user/code/ref/remark-cite/mdast-util-cite/node_modules/rollup/dist/shared/loadConfigFile.js:616:17)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
  1. a) After running:

$ yarn global install typescript

  1. b) I got:
yarn install v1.22.18
warning ../../../../package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] πŸ”  Resolving packages...
success Already up-to-date.
$ npm run clean; npm run build

> @benrbray/mdast-util-cite@1.1.0 clean
> npx del dist

> @benrbray/mdast-util-cite@1.1.0 build
> rollup -c

src/index.ts β†’ dist/index.umd.js...
[!] (plugin Typescript) TypeError: path.charCodeAt is not a function
src/index.ts
TypeError: path.charCodeAt is not a function
    at getEncodedRootLength (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:7660:24)
    at Object.isRootedDiskPath (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:7567:16)
    at Object.isExternalModuleNameRelative (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:12360:52)
    at tryLoadModuleUsingOptionalResolutionSettings (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:43173:17)
    at tryResolve (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:43376:28)
    at /opt/homebrew/lib/node_modules/typescript/lib/typescript.js:43372:69
    at Object.forEach (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:377:30)
    at nodeModuleNameResolverWorker (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:43372:25)
    at nodeModuleNameResolver (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:43347:16)
    at Object.resolveModuleName (/opt/homebrew/lib/node_modules/typescript/lib/typescript.js:43074:30)
  1. At this point I gave up on yarn and installed the dependencies via npm inside of each subproject.

βœ… This worked and I was able to use yarn to run tests successfully after that.


Apologies if I'm just derping on the environment setup. Thanks again! πŸ™


PS Two tests are failing for me as well (can file another issue if it's unrelated to the above description):

  remark-cite (toMarkdown)
    to markdown
      βœ“ [to-md 001] option: useNodeValue=true
   ❌ 1) [to-md 002] option: useNodeValue=true, pandoc syntax
   ❌ 2) [to-md 003] option: useNodeValue=true, alt syntax

 ...

  68 passing (66ms)
  2 failing

 ...

  1) remark-cite (toMarkdown)
       to markdown
         [to-md 002] option: useNodeValue=true, pandoc syntax:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ '[\\@peyton-jones2003]'
- '[@peyton-jones2003]'
      + expected - actual

      -[\@peyton-jones2003]
      +[@peyton-jones2003]

      at Context.<anonymous> (test/test.ts:146:12)
      at processImmediate (node:internal/timers:466:21)

  2) remark-cite (toMarkdown)
       to markdown
         [to-md 003] option: useNodeValue=true, alt syntax:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ '\\@[peyton-jones2003; \\@wadler1999]'
- '@[peyton-jones2003; @wadler1999]'
      + expected - actual

      -\@[peyton-jones2003; \@wadler1999]
      +@[peyton-jones2003; @wadler1999]

      at Context.<anonymous> (test/test.ts:146:12)
      at processImmediate (node:internal/timers:466:21)
manunamz commented 2 years ago

I just noticed the package-lock.json -- which I have heard is not meant to be mixed with yarn...That might be my issue...

benrbray commented 1 month ago

After #10, I revised the build process & simplified the final bundled code. So, I'll close this issue for now, but I'm happy to reopen if there are still any install issues with the new version.