extension.js icon indicating copy to clipboard operation
extension.js copied to clipboard

can not init project

Open xdewx opened this issue 7 months ago • 13 comments

npx extension create browser-extension

node:internal/modules/cjs/loader:1145 throw err; ^

Error: Cannot find module 'svelte-preprocess' Require stack:

  • /home/xxx/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-develop/dist/module.js
  • /home/xxx/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension/dist/cli.js at Module._resolveFilename (node:internal/modules/cjs/loader:1142:15) at Module._load (node:internal/modules/cjs/loader:983:27) at Module.require (node:internal/modules/cjs/loader:1230:19) at require (node:internal/modules/helpers:179:18) at Object. (/home/xxx/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-develop/dist/module.js:76:14762) at Module._compile (node:internal/modules/cjs/loader:1368:14) at Module._extensions..js (node:internal/modules/cjs/loader:1426:10) at Module.load (node:internal/modules/cjs/loader:1205:32) at Module._load (node:internal/modules/cjs/loader:1021:12) at Module.require (node:internal/modules/cjs/loader:1230:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/xxx/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-develop/dist/module.js', '/home/xxx/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension/dist/cli.js' ] }

Node.js v21.7.3

xdewx avatar May 09 '25 03:05 xdewx

@xdewx thanks for reporting. what shows up when you run npx extension --version?

cezaraugusto avatar May 09 '25 17:05 cezaraugusto

npx extension --version

% npx  --version             
10.5.0
(base) [xxx@kali:~ on main]
% node -v
v21.7.3

xdewx avatar May 12 '25 06:05 xdewx

great! what about Extension.js?

npx extension --version

also, can you try running the latest release?

npx extension@latest create browser-extension

cezaraugusto avatar May 12 '25 16:05 cezaraugusto

npx extension --version

(base) % npx extension --version

Need to install the following packages:
[email protected]
Ok to proceed? (y) y
npm notice 
npm notice New major version of npm available! 10.5.0 -> 11.4.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.4.0
npm notice Run npm install -g [email protected] to update!
npm notice 
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected].
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in: /home/xxx/.npm/_logs/2025-05-16T09_30_50_740Z-debug-0.log

xdewx avatar May 16 '25 09:05 xdewx

should be fixed in latest v2.0.0-rc.27

cezaraugusto avatar May 19 '25 13:05 cezaraugusto

I'm still seeing this issue, even with rc.27

$ npx extension create my-extension
Need to install the following packages:
[email protected]
Ok to proceed? (y)

🐣 - Starting a new browser extension named my-extension...
🤝 - Ensuring my-extension folder exists...
🤞 - Checking if destination path is writeable...
🔎 - Scanning for potential conflicting files...
🧰 - Installing my-extension...
Error: ENOENT: no such file or directory, open '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
    at async open (node:internal/fs/promises:634:25)
    at async Object.readFile (node:internal/fs/promises:1238:14)
    at async overridePackageJson (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:329:32)
    at async extensionCreate (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:575:9)
    at async Command.<anonymous> (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension/dist/cli.js:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
}
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error: ENOENT: no such file or directory, open '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
    at async open (node:internal/fs/promises:634:25)
    at async Object.readFile (node:internal/fs/promises:1238:14)
    at async overridePackageJson (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:329:32)
    at async extensionCreate (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:575:9)
    at async Command.<anonymous> (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension/dist/cli.js:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
}

Node.js v23.11.0

It does create the following:

my-extension/
├── manifest.json
├── package.json
└── README.md

but I'm not sure if that's sufficient to ignore the error and move forward.

matejaputic avatar May 24 '25 10:05 matejaputic

I'm still seeing this issue, even with rc.27

$ npx extension create my-extension
Need to install the following packages:
[email protected]
Ok to proceed? (y)

🐣 - Starting a new browser extension named my-extension...
🤝 - Ensuring my-extension folder exists...
🤞 - Checking if destination path is writeable...
🔎 - Scanning for potential conflicting files...
🧰 - Installing my-extension...
Error: ENOENT: no such file or directory, open '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
    at async open (node:internal/fs/promises:634:25)
    at async Object.readFile (node:internal/fs/promises:1238:14)
    at async overridePackageJson (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:329:32)
    at async extensionCreate (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:575:9)
    at async Command.<anonymous> (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension/dist/cli.js:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
}
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error: ENOENT: no such file or directory, open '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
    at async open (node:internal/fs/promises:634:25)
    at async Object.readFile (node:internal/fs/promises:1238:14)
    at async overridePackageJson (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:329:32)
    at async extensionCreate (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/dist/module.js:575:9)
    at async Command.<anonymous> (/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension/dist/cli.js:95:5) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/macos/.npm/_npx/3b1fc9cdc75022aa/node_modules/extension-create/template/package.json'
}

Node.js v23.11.0

It does create the following:

my-extension/
├── manifest.json
├── package.json
└── README.md

but I'm not sure if that's sufficient to ignore the error and move forward.

same happened to me

tingkelvin avatar Jun 03 '25 22:06 tingkelvin

sorry about that! pls try again with [email protected]

cezaraugusto avatar Jun 04 '25 18:06 cezaraugusto

npx extension@latest create my-extension

cezaraugusto avatar Jun 04 '25 18:06 cezaraugusto

npx extension@latest create my-extension

not work! and latest is 2.0.0-rc.27 pnpx came across the same error.

❯ npx extension@latest create browser-ipa
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
/home/xxx/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js:43
const external_chalk_namespaceObject = require("chalk");
                                       ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/xxx/.npm/_npx/59982b092aad6098/node_modules/chalk/source/index.js from /home/xxx/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js not supported.
Instead change the require of index.js in /home/xxx/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/su/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js:43:40) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.13.1

xdewx avatar Jun 06 '25 08:06 xdewx

npx extension@latest create my-extension

running with node 22, seems like everything is working

tingkelvin avatar Jun 06 '25 10:06 tingkelvin

@xdewx npx cache is huge, try explicitly running latest [email protected]. lmk how it goes

cezaraugusto avatar Jun 06 '25 17:06 cezaraugusto

@xdewx npx cache is huge, try explicitly running latest [email protected]. lmk how it goes

➜ pnpm view extension versions [ '0.0.1', '0.0.2', '0.1.0', '0.1.1', '0.1.2', '0.2.0', '0.2.2', '1.1.1', '1.2.0', '1.2.1', '1.2.2', '1.2.4', '1.2.5', '1.3.0', '1.4.0-0', '1.4.0', '1.4.1', '1.4.2', '1.4.3-0', '1.4.4', '1.4.5', '1.4.6', '1.5.0', '1.6.0-beta.0', '1.6.0-beta.1', '1.6.0', '1.7.0-beta.0', '1.7.0-beta.1', '1.7.0', '1.7.1', '1.8.0-beta.0', '1.8.0-beta.1', '1.8.0-beta.2', '1.8.0', '2.0.0-alpha.0', '2.0.0-alpha.1', '2.0.0-alpha.2', '2.0.0-alpha.3', '2.0.0-alpha.4', '2.0.0-alpha.5', '2.0.0-alpha.6', '2.0.0-alpha.7', '2.0.0-alpha.8', '2.0.0-alpha.9', '2.0.0-alpha.10', '2.0.0-alpha.11', '2.0.0-alpha.12', '2.0.0-alpha.13', '2.0.0-alpha.14', '2.0.0-alpha.15', '2.0.0-alpha.16', '2.0.0-alpha.17', '2.0.0-alpha.18', '2.0.0-alpha.19', '2.0.0-alpha.20', '2.0.0-alpha.21', '2.0.0-alpha.22', '2.0.0-alpha.23', '2.0.0-alpha.24', '2.0.0-alpha.25', '2.0.0-alpha.26', '2.0.0-alpha.27', '2.0.0-alpha.28', '2.0.0-alpha.29', '2.0.0-alpha.30', '2.0.0-alpha.31', '2.0.0-alpha.32', '2.0.0-alpha.33', '2.0.0-alpha.34', '2.0.0-alpha.35', '2.0.0-alpha.36', '2.0.0-alpha.37', '2.0.0-beta.0', '2.0.0-beta.1', '2.0.0-beta.2', '2.0.0-beta.3', '2.0.0-beta.4', '2.0.0-beta.5', '2.0.0-beta.6', '2.0.0-beta.7', '2.0.0-beta.8', '2.0.0-beta.9', '2.0.0-rc.0', '2.0.0-rc.1', '2.0.0-rc.2', '2.0.0-rc.3', '2.0.0-rc.4', '2.0.0-rc.5', '2.0.0-rc.6', '2.0.0-rc.7', '2.0.0-rc.8', '2.0.0-rc.9', '2.0.0-rc.10', '2.0.0-rc.11', '2.0.0-rc.12', '2.0.0-rc.13', '2.0.0-rc.14', '2.0.0-rc.15', '2.0.0-rc.16', '2.0.0-rc.17', '2.0.0-rc.18', '2.0.0-rc.19', '2.0.0-rc.20', '2.0.0-rc.21', '2.0.0-rc.22', '2.0.0-rc.23', '2.0.0-rc.24', '2.0.0-rc.25', '2.0.0-rc.26', '2.0.0-rc.27', '2.0.0-rc.28', '2.0.0-rc.29', '2.0.0-rc.30', '2.0.0-rc.31', '2.0.0-rc.32', '2.0.0-rc.33', '2.0.0-rc.34', '2.0.0-rc.35', '2.0.0-rc.36' ]

/src/extension ➜ npx extension@latest create browser-ipa Need to install the following packages: [email protected] Ok to proceed? (y) y /home/su/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js:43 const external_chalk_namespaceObject = require("chalk"); ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/su/.npm/_npx/59982b092aad6098/node_modules/chalk/source/index.js from /home/su/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js not supported. Instead change the require of index.js in /home/su/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js to a dynamic import() which is available in all CommonJS modules. at Object. (/home/su/.npm/_npx/59982b092aad6098/node_modules/extension-create/dist/module.js:43:40) { code: 'ERR_REQUIRE_ESM' }

Node.js v20.13.1

xdewx avatar Jun 07 '25 11:06 xdewx