simple-plist icon indicating copy to clipboard operation
simple-plist copied to clipboard

Cannot find module 'bplist-creator'

Open larryhuang opened this issue 3 years ago • 14 comments

Environment:

  • Node 16.9.1
  • electron 16.0.0
  • electron-builder 22.14.5
  • simple-plist 1.3.0
  • webpack 5.64.1
  • windows 11

Scenario

  • Developing in Windows 11 + Visual studio code
  • Run npm start to launch my application
  • show bplist-creator error

Error

  • Uncaught Exception
  • Error: Cannot find module 'bplist-creator' Screen Shot 2021-12-09 at 21 03 40

larryhuang avatar Dec 09 '21 13:12 larryhuang

Its still giving issue with node v14.18.0 and simple-plist version 1.3.0 not with 1.1.0

rajmonotype avatar Mar 15 '22 06:03 rajmonotype

I haven't seen this issue myself and I can't seem to reproduce it locally with node v16.13.0 on macOS. @rajmonotype are you also on Windows by chance?

wollardj avatar Mar 31 '22 02:03 wollardj

I think the issue might relate to using ESM imports, I can reproduce the problem if I use import instead of require.

dnicolson avatar Apr 05 '22 20:04 dnicolson

@larryhuang have you find a way to fix the issue?

realtril avatar Apr 06 '22 07:04 realtril

@rajmonotype have you find a way to fix the issue?

realtril avatar Apr 06 '22 07:04 realtril

The issue I'm experiencing appears to relate to changes in version 1.3.1 where a default export is incompatible with version 1.3.0 for ESM imports but still may be relevant to this issue.

CommonJS imports work with 1.3.1 but ESM imports have issues with missing types in bplist-creator and bplist-parser and there is no default export in bplist-parser.

dnicolson avatar Apr 10 '22 21:04 dnicolson

The issue I'm experiencing appears to relate to changes in version 1.3.1 where a default export is incompatible with version 1.3.0 for ESM imports but still may be relevant to this issue.

CommonJS imports work with 1.3.1 but ESM imports have issues with missing types in bplist-creator and bplist-parser and there is no default export in bplist-parser.

@dnicolson how did you solve an issue?

realtril avatar Apr 13 '22 10:04 realtril

@realtril I don't have a solution, have you tried using CommonJS imports? For example:

const plist = require("simple-plist");

dnicolson avatar Apr 14 '22 09:04 dnicolson

dnicolson

yeah, simple-plist is a subdependency. so all over the places it is being used by CommonJS imports.

realtril avatar Apr 14 '22 11:04 realtril

Hey @larryhuang et al. I've just released v1.4.0 over on npm under the next tag. I realize this issue is old, but if anyone listed here is still struggling with the issue, please give 1.4.0 a shot and let me know if it does the trick.

wollardj avatar Jul 10 '22 15:07 wollardj

I had this issue on the latest stable 1.3.1. Upgrading to 1.4.0 changes which module this breaks on:

import plist from "simple-plist"

yarn run v1.22.19
$ npx ttsc
node_modules/simple-plist/dist/parse.d.ts:3:33 - error TS7016: Could not find a declaration file for module 'plist'. '/Users/myusername/path/to/my/repo/node_modules/plist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/plist` if it exists or add a new declaration (.d.ts) file containing `declare module 'plist';`

3 import type { PlistValue } from "plist";
                                  ~~~~~~~


Found 1 error in node_modules/simple-plist/dist/parse.d.ts:3

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment:

  • node 18
  • typescript 4.5.3
  • ttypescript 1.5.13
// tsconfig.json
{
  "compilerOptions": {
    "esModuleInterop": true,
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "dist",
    "plugins": [
      {
        "transform": "typia/lib/transform"
      }
    ],
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compileOnSave": true,
  "include": [
    "src"
  ],
}

walkingbrad avatar Mar 16 '23 21:03 walkingbrad

@walkingbrad there are no default exports, according to the documentation you need to import named exports:

import * as plist from "simple-plist";

With version 1.4.0 I see different errors outlined in https://github.com/wollardj/simple-plist/pull/68#issuecomment-1666886401.

dnicolson avatar Aug 06 '23 14:08 dnicolson

Hey @larryhuang et al. I've just released v1.4.0 over on npm under the next tag. I realize this issue is old, but if anyone listed here is still struggling with the issue, please give 1.4.0 a shot and let me know if it does the trick.

I've just tried 1.4.0-0 and it fixes my issue, compiling fine now. Is there an ETA for when 1.4.0 will be fully released or if the type issues can be fixed in the 1.3 branch?

What I was seeing: with import plist from 'simple-plist'

My errors: image

image

I also got errors with bplistCreator when I was noodling around trying to get around it.

Here's the full set of errors shown in vscode Problems when I look at the file image

davfive avatar Oct 05 '23 17:10 davfive

"simple-plist": "next" does fix the compiler errors 🙏

walkingbrad avatar Oct 27 '23 22:10 walkingbrad