Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string-width: Cannot use import statement outside a module #2359

Closed
glassdimlygr opened this issue Mar 4, 2024 · 1 comment
Closed

string-width: Cannot use import statement outside a module #2359

glassdimlygr opened this issue Mar 4, 2024 · 1 comment

Comments

@glassdimlygr
Copy link

Issue or Feature

We've recently upgraded from yarn 1 to yarn 4, and from Node 14 to 18.

Here's what I see

yarn add canvas
➤ YN0000: · Yarn 4.0.2
...
Link step
➤ YN0007: │ canvas@npm:2.11.2 must be built because it never has been before or the last one failed
➤ YN0009: │ canvas@npm:2.11.2 couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/mr/pndknkld65vccbzpt5vhwbt4l2tnp_/T/xfs-eb6ae8cb/build.log)

contents of /private/var/folders/mr/pndknkld65vccbzpt5vhwbt4l2tnp_/T/xfs-eb6ae8cb/build.log)

# This file contains the result of Yarn building a package (canvas@npm:2.11.2)
# Script name: install

/Users/jjohn/www/rate.com/node_modules/gauge/wide-truncate.js:2
import stringWidth from 'string-width'
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1274:20)
    at Module._compile (node:internal/modules/cjs/loader:1320:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Module.require (node:internal/modules/cjs/loader:1225:19)
    at require (node:internal/modules/helpers:177:18)
    at Object.<anonymous> (/Users/jjohn/www/rate.com/node_modules/gauge/render-template.js:4:20)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)

Node.js v18.19.0

Your Environment

  • Mac 14.3.1
❯ npm list canvas

├── canvas@2.11.2
└─┬ jest-environment-jsdom@29.6.2
  ├── canvas@2.11.2 deduped
  └─┬ jsdom@20.0.3
    └── canvas@2.11.2 dedup
@glassdimlygr
Copy link
Author

Resolved with yarn add gauge -D, which, at time of writing, installed 5.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant