lossless-cut icon indicating copy to clipboard operation
lossless-cut copied to clipboard

postcss-safe-parser - Package subpath './lib/tokenize' is not defined by "exports"

Open vindicatorr opened this issue 3 years ago • 11 comments

In order to make it easier for me to help you, I ask that you please try these things first:

  • Try with the newest version from GitHub: https://github.com/mifi/lossless-cut/releases/latest
  • Check https://github.com/mifi/lossless-cut and Known issues / Troubleshooting
  • Search for your problem under Issues or Discussions
  • Please try other type of file and see if it works.

Share information to help me understand

  • If you have a problem or an unexpected bug or crash, please open developer tools after starting LosslessCut and before doing the failing operation. Then share the output from the javascript Console. (Menu: Tools > Toggle Developer Tools)

Describe the bug Package subpath './lib/tokenize' is not defined by "exports" for postcss-safe-parser

To Reproduce Steps to reproduce the behavior:

  1. $ git checkout master //(or "$ git checkout v3.39.0" since that's a Release)
  2. $ yarn
  3. $ npm start
  4. See output including error below

Expected behavior Run without crashing

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Arch Linux Additional context
$ yarn
yarn install v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "react-is@^16.8.0 || ^17.0.0".
warning " > [email protected]" has incorrect peer dependency "react@^16.8".
warning " > [email protected]" has incorrect peer dependency "react-dom@^16.8".
warning "i18next-scanner > [email protected]" has incorrect peer dependency "acorn@^6.0.0".
warning " > [email protected]" has incorrect peer dependency "react@^0.14.9 || ^15.3.0 || ^16.0.0-rc || ^16.0".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > [email protected]" has unmet peer dependency "prop-types@^15.5.7".
warning " > [email protected]" has unmet peer dependency "@types/sortablejs@^1.10.0".
warning " > [email protected]" has incorrect peer dependency "react@^16.9.0".
warning " > [email protected]" has incorrect peer dependency "react-dom@^16.9.0".
warning " > [email protected]" has incorrect peer dependency "react@^16.8.0".
warning " > [email protected]" has incorrect peer dependency "react-dom@^16.8.0".
[4/4] Building fresh packages...
$ patch-package && electron-builder install-app-deps
patch-package 6.4.7
Applying patches...
[email protected] ✔
  • electron-builder  version=22.13.1
  • loaded configuration  file=package.json ("build" field)
  • loaded parent configuration  preset=react-cra
Done in 148.16s.
$ npm start

> [email protected] start
> concurrently -k "cross-env BROWSER=none PORT=3001 DISABLE_ESLINT_PLUGIN=true react-scripts start" "wait-on http://localhost:3001 && electron ."

[0] node:internal/modules/cjs/loader:488
[0]       throw e;
[0]       ^
[0] 
[0] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in <pathTo>/lossless-cut/node_modules/postcss-safe-parser/node_modules/postcss/package.json
[0]     at new NodeError (node:internal/errors:371:5)
[0]     at throwExportsNotFound (node:internal/modules/esm/resolve:429:9)
[0]     at packageExportsResolve (node:internal/modules/esm/resolve:683:3)
[0]     at resolveExports (node:internal/modules/cjs/loader:482:36)
[0]     at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
[0]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
[0]     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[0]     at Module.require (node:internal/modules/cjs/loader:999:19)
[0]     at require (node:internal/modules/cjs/helpers:102:18)
[0]     at Object.<anonymous> (<pathTo>/lossless-cut/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) {
[0]   code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
[0] }
[0] 
[0] Node.js v17.3.0
[0] cross-env BROWSER=none PORT=3001 DISABLE_ESLINT_PLUGIN=true react-scripts start exited with code 1
--> Sending SIGTERM to other processes..
[1] wait-on http://localhost:3001 && electron . exited with code SIGTERM

Reference: https://github.com/postcss/postcss-safe-parser/issues/29

vindicatorr avatar Jan 08 '22 10:01 vindicatorr

Can you try node 16?

mifi avatar Jan 08 '22 10:01 mifi

Maybe, though that would also mean I need to downgrade nodejs dependencies, and be wary of what doing so would break what already exists, no? I know it worked when I built/ran it early last year and that would've been v15 or 16. I don't remember the exact month and that pkg cache shows the transition from v15 to 16 in April.

This is more of a heads-up of what's coming down the pipeline.

vindicatorr avatar Jan 08 '22 10:01 vindicatorr

Ok. node.js 17 is not stable yet, so I'm not going to work on fixing any issues related to it yet, but we can leave this open as a todo. probably can be fixed by an upgrade of create-react-app or running yarn upgarde

mifi avatar Jan 09 '22 09:01 mifi

Just an update:

$ GENERATE_SOURCEMAP=false npm start

> [email protected] start
> concurrently -k "npm run start:frontend" "npm run start:electron"

[0] 
[0] > [email protected] start:frontend
[0] > cross-env BROWSER=none PORT=3001 DISABLE_ESLINT_PLUGIN=true react-scripts start
[0] 
[1] 
[1] > [email protected] start:electron
[1] > wait-on http://localhost:3001 && electron .
[1] 
[0] (node:192825) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
[0] (Use `node --trace-deprecation ...` to show where the warning was created)
[0] (node:192825) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
[0] Starting the development server...
[0] 
[0] Compiled successfully!
[0] 
[0] You can now view lossless-cut in the browser.
[0] 
[0]   Local:            http://localhost:3001
[0]   On Your Network:  http://192.168.2.11:3001
[0] 
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0] 
[0] assets by path static/media/*.woff2 140 KiB
[0]   asset static/media/open-sans-v17-latin-800.1666787ea3ff3941e764.woff2 14.7 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-800.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-700.92425c623934facef057.woff2 14.7 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-700.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-300.b871ad6e5cbe2a1c8c73.woff2 14.6 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-300.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-600.9526470852428b4340ed.woff2 14.5 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-600.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-regular.f57a62e9efddf6ace18b.woff2 14 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-regular.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-800italic.b5bc26612cdf4d47affd.woff2 13.6 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-800italic.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-700italic.2a0783bd1c6c1469558b.woff2 13.6 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-700italic.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-300italic.b45d9997b704ab3daad1.woff2 13.5 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-300italic.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-600italic.cc4bf5b2955147801c02.woff2 13.5 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-600italic.woff2] (auxiliary name: main)
[0]   asset static/media/open-sans-v17-latin-italic.bb915319f59c02c348a6.woff2 13.5 KiB [emitted] [immutable] [from: src/fonts/open-sans-v17-latin-italic.woff2] (auxiliary name: main)
[0] asset static/js/bundle.js 21 MiB [emitted] (name: main) 1 related asset
[0] asset asset-manifest.json 1.4 KiB [emitted]
[0] asset index.html 203 bytes [emitted]
[0] orphan modules 2.42 MiB [orphan] 1147 modules
[0] runtime modules 28.6 KiB 15 modules
[0] cacheable modules 18.9 MiB (javascript) 140 KiB (asset)
[0]   modules by path ./node_modules/ 18.2 MiB 929 modules
[0]   modules by path ./src/ 698 KiB (javascript) 140 KiB (asset)
[0]     javascript modules 653 KiB 77 modules
[0]     asset modules 420 bytes (javascript) 140 KiB (asset)
[0]       ./src/fonts/open-sans-v17-latin-300.woff2 42 bytes (javascript) 14.6 KiB (asset) [built] [code generated]
[0]       ./src/fonts/open-sans-v17-latin-300italic.woff2 42 bytes (javascript) 13.5 KiB (asset) [built] [code generated]
[0]       ./src/fonts/open-sans-v17-latin-regular.woff2 42 bytes (javascript) 14 KiB (asset) [built] [code generated]
[0]       ./src/fonts/open-sans-v17-latin-italic.woff2 42 bytes (javascript) 13.5 KiB (asset) [built] [code generated]
[0]       ./src/fonts/open-sans-v17-latin-600.woff2 42 bytes (javascript) 14.5 KiB (asset) [built] [code generated]
[0]       + 5 modules
[0]     ./src/7077-magic-flow.json 44.4 KiB [built] [code generated]
[0]   os (ignored) 15 bytes [built] [code generated]
[0] webpack 5.72.0 compiled successfully in 43071 ms

It just hangs here, and electron never starts. When I go to http://127.0.0.1:3001/, the browser developer tools message shows:

util.js:6 Uncaught TypeError: window.require is not a function
    at Module../src/util.js (util.js:6:1)
    at Module.options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at Module../src/hooks/useUserSettingsRoot.js (useUserSettings.js:5:1)
    at Module.options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at Module../src/App.jsx (bundle.js:41:85)
    at Module.options.factory (react refresh:6:1)

The network activity show the "html(index)", "bundle.js", "ws" (with "ok" response), and "favicon.ico"

You mentioned "node.js 17 is not stable yet", and while I don't really use node, one thing I learned (while playing with other projects that use node) was that nodejs 17 was released last year and also that LTS are even-number versions. So, I'm not all that sure what the "stable" aspect you were referring to.

EDIT0: OH! I forgot to mention that something else I learned was "nodeenv" which allows me to use a separate node environment. With node 16.14.2, it continues on with:

...
[0] webpack 5.66.0 compiled successfully in 39237 ms
[1] CLI arguments { _: [] }
[1] Current version 3.44.0
[1] Newest version 3.44.0
[1] Failed to fetch extension, trying 4 more times
[1] Failed to fetch extension, trying 3 more times
[1] Failed to fetch extension, trying 2 more times
[1] Failed to fetch extension, trying 1 more times
[1] Failed to fetch extension, trying 0 more times
[1] Failed to add extension Error: net::ERR_BLOCKED_BY_RESPONSE
[1]     at SimpleURLLoaderWrapper.<anonymous> (electron/js2c/browser_init.js:2568:21)
[1]     at SimpleURLLoaderWrapper.emit (events.js:210:5)

And the progam has an error popup:

LosslessCut is installation is broken
Command failed with ENOENT: ffmpeg/linux-x64/ffmpeg -hide_banner -f lavfi -i nullsrc=s=256x256:d=1 -f null - spawn ffmpeg/linux-x64/ffmpeg ENOENT

vindicatorr avatar Apr 15 '22 02:04 vindicatorr

oops what i meant to say is that node17 is not LTS. node16 is currently the recommended version to use (see https://nodejs.org/en/). node17 is their intermediary version before releasing node18.

as for the ffmpeg error, you need to provide ffmpeg in that path. you can either run npm run download-ffmpeg-linux or download/build ffmpeg/ffprobe yourself (or select the system wide ffmpeg from Settings)

mifi avatar Apr 15 '22 04:04 mifi

yarn upgarde

Node.js v17.3.0 error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. (base) apple@appledeMacBook-Pro frontend % yarn upgarde yarn run v1.22.10 error Command "upgarde" not found. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

yangboz avatar Apr 22 '22 01:04 yangboz

I'm sure upgarde was just a mistype for upgrade by them. Anyway, just source a v16 node environment like I did or wait for the next LTS (v18).

vindicatorr avatar Apr 22 '22 01:04 vindicatorr

This issue persists in Node v18 (the current release and LTS-to-be).

zmknox avatar Jun 04 '22 18:06 zmknox

npm run build

[email protected] build react-scripts build node:internal/modules/cjs/loader:535 throw e; ^ Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/tokenize' is not defined by "exports" in /builds/vistaprint-org/algorithmic-design/asset/ui/asset-management-ui/node_modules/postcss-safe-parser/node_modules/postcss/package.json at new NodeError (node:internal/errors:393:5) at throwExportsNotFound (node:internal/modules/esm/resolve:358:9) at packageExportsResolve (node:internal/modules/esm/resolve:668:3) at resolveExports (node:internal/modules/cjs/loader:529:36) at Module._findPath (node:internal/modules/cjs/loader:569:31) at Module._resolveFilename (node:internal/modules/cjs/loader:981:27) at Module._load (node:internal/modules/cjs/loader:841:27) at Module.require (node:internal/modules/cjs/loader:1061:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/builds/vistaprint-org/algorithmic-design/asset/ui/asset-management-ui/node_modules/postcss-safe-parser/lib/safe-parser.js:1:17) { code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' } Node.js v18.12.1

nitinmagdumvista avatar Nov 14 '22 09:11 nitinmagdumvista

I am facing same issue Node.js v18.12.1.

Which node version works?

sbakshi007 avatar Dec 19 '22 04:12 sbakshi007

16 works. Not sure how to fix this. Upgrade react-scripts maybe?

mifi avatar Dec 19 '22 04:12 mifi

node 16 works.

knight174 avatar Jan 23 '23 14:01 knight174

I probably want to change from create-react-app to Vite, because the former is unmaintained. Then this problem should go away

mifi avatar Jan 27 '23 04:01 mifi

I had this issue running following a youtube tutorial - https://www.youtube.com/watch?v=c1xTDSIXit8&list=PLj-4DlPRT48mxPG8TAXOH4qqQ1ijuERO4.

To fix it I did the following:

  1. Removed the yarn.lock file
  2. Ran "npm I" or "npm install" to get the node-modules installed
  3. Ran "npm uninstall react-scripts" to remove the react-scripts that came with the repository I cloned from the tutorial
  4. Ran "npm i react-scripts" or "npm install react-scripts" to restore react-scripts as am running Node v18.

This resolved my problem.

iqplusice avatar Feb 01 '23 11:02 iqplusice

I had this issue running following a youtube tutorial - https://www.youtube.com/watch?v=c1xTDSIXit8&list=PLj-4DlPRT48mxPG8TAXOH4qqQ1ijuERO4.

To fix it I did the following:

  1. Removed the yarn.lock file
  2. Ran "npm I" or "npm install" to get the node-modules installed
  3. Ran "npm uninstall react-scripts" to remove the react-scripts that came with the repository I cloned from the tutorial
  4. Ran "npm i react-scripts" or "npm install react-scripts" to restore react-scripts as am running Node v18.

This resolved my problem.

This works for me and thx a lot.

shurintou avatar Mar 08 '23 15:03 shurintou

Weird Bug

NMDSKY avatar Apr 13 '24 22:04 NMDSKY