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

Could not find @ember-apply/tailwind or tailwind on npm #95

Closed
MichalBryxi opened this issue Feb 14, 2022 · 13 comments
Closed

Could not find @ember-apply/tailwind or tailwind on npm #95

MichalBryxi opened this issue Feb 14, 2022 · 13 comments

Comments

@MichalBryxi
Copy link
Sponsor Contributor

MichalBryxi commented Feb 14, 2022

I was trying to play with this + ember-cli template on stakblitz and I got this error: Could not find @ember-apply/tailwind or tailwind on npm.

Steps to reproduce

  1. GOTO: https://stackblitz.com/github/ember-cli/ember-new-output?
  2. Run:
~/projects/qgnivgjvn.github 1m 37s
npx ember-apply tailwind
warn verifyTree [email protected]: The engine "node" is incompatible with this
module. Expected version ">=16.0.0" found "v14.17.0".
success Install finished in 16.06s

ℹ Skypack unavailable, downloading from npm
✖ Could not find @ember-apply/tailwind or tailwind on npm
AssertionError [ERR_ASSERTION]: Could not find @ember-apply/tailwind or tailwind on npm
    at downloadFromNpm (file:///home/.turbo/npx/ff17AI/node_modules/ember-apply/src/cli/resolve.js:164:18)
    at async Module.resolveApplyable (file:///home/.turbo/npx/ff17AI/node_modules/ember-apply/src/cli/resolve.js:46:6)
    at async getApplyable (file:///home/.turbo/npx/ff17AI/node_modules/ember-apply/src/cli/index.js:87:25)
    at async run (file:///home/.turbo/npx/ff17AI/node_modules/ember-apply/src/cli/index.js:68:21)
    at async Object.eval [as handler] (file:///home/.turbo/npx/ff17AI/node_modules/ember-apply/src/cli/index.js:46:9) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: null,
  expected: true,
  operator: '=='
}
@NullVoxPopuli
Copy link
Owner

Huh, i wonder if stackblitz blocks certain api requests

@NullVoxPopuli
Copy link
Owner

Fwiw, this is the supported ember link: https://github.com/ember-cli/editor-output/tree/stackblitz-app-output

Trying to work with stackblitz here: stackblitz/webcontainer-core#354
To add a link to their site

@jacobq
Copy link
Contributor

jacobq commented Apr 16, 2022

Not sure if this is the same problem or not, but I just tried using this for the first time (Windows 11, MINGW64 / git bash shell, new/empty ember 4.2 app):

$ npx ember-apply tailwind
Need to install the following packages:
  ember-apply
Ok to proceed? (y)
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
× Cannot find package 'tailwind' imported from C:\Users\jacob\AppData\Local\npm-cache\_npx\4a3d1908b81a92e4\node_modules\ember-apply\src\cli\resolve.js
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'tailwind' imported from C:\Users\jacob\AppData\Local\npm-cache\_npx\4a3d1908b81a92e4\node_modules\ember-apply\src\cli\resolve.js
    at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:884:9)
    at moduleResolve (node:internal/modules/esm/resolve:929:18)
    at defaultResolve (node:internal/modules/esm/resolve:1044:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
    at ESMLoader.import (node:internal/modules/esm/loader:276:22)
    at importModuleDynamically (node:internal/modules/esm/translators:111:35)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
    at tryResolve (file:///C:/Users/jacob/AppData/Local/npm-cache/_npx/4a3d1908b81a92e4/node_modules/ember-apply/src/cli/resolve.js:270:27) {
  code: 'ERR_MODULE_NOT_FOUND'
}

@NullVoxPopuli
Copy link
Owner

NullVoxPopuli commented Apr 17, 2022

🤔
maybe, here is my full console output
(including me showing that I often forget to cd into the app I just created)

I'm on linux though, and don't have a way to test on windows locally.

however! if someone wants to add windows to the C.I. for this repo, that'd be hugely appreciated.

the console output (lots)
~/Development/tmp took 9s 
❯ ember new my-app
installing app
Ember CLI v4.3.0

✨  Creating a new Ember app in <repo>:
  create .editorconfig
  create .ember-cli
  create .eslintignore
  create .eslintrc.js
  create .github/workflows/ci.yml
  create .prettierignore
  create .prettierrc.js
  create .template-lintrc.js
  create .watchmanconfig
  create README.md
  create app/app.js
  create app/components/.gitkeep
  create app/controllers/.gitkeep
  create app/helpers/.gitkeep
  create app/index.html
  create app/models/.gitkeep
  create app/router.js
  create app/routes/.gitkeep
  create app/styles/app.css
  create app/templates/application.hbs
  create config/ember-cli-update.json
  create config/environment.js
  create config/optional-features.json
  create config/targets.js
  create ember-cli-build.js
  create .gitignore
  create package.json
  create public/robots.txt
  create testem.js
  create tests/helpers/index.js
  create tests/index.html
  create tests/integration/.gitkeep
  create tests/test-helper.js
  create tests/unit/.gitkeep
  create vendor/.gitkeep
WARNING: Ember CLI is using the global npm, but your npm version has not yet been verified to work with the current Ember CLI release.

🚧  Installing packages... This might take a couple of minutes.
npm: Installed dependencies

🎥  Initializing git repository.
Git: successfully initialized.

🎉  Successfully created project my-app.
👉   Get started by typing:

  $ cd my-app
  $ npm start

Happy coding!

~/Development/tmp took 50s 
❯ npx ember-apply tailwind
Need to install the following packages:
  ember-apply
Ok to proceed? (y) y
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
ℹ Skypack unavailable, downloading from npm
ℹ Applying: tailwind
ℹ If there are any bugs with this applyable, feel free to report at https://github.com/NullVoxPopuli/ember-apply/issues
✖ ENOENT: no such file or directory, open '/✂️/package.json'
[Error: ENOENT: no such file or directory, open '/✂️/package.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/✂️/package.json'
}

~/Development/tmp took 29s 
❯ cd my-app/

my-app on  main 

   

❯ npx ember-apply tailwind
ℹ Skypack unavailable, downloading from npm
ℹ Applying: tailwind
ℹ If there are any bugs with this applyable, feel free to report at https://github.com/NullVoxPopuli/ember-apply/issues
✔ Applied feature: tailwind

my-app on  main [!?] 

   
took 8s 
❯ gd
diff --git a/.gitignore b/.gitignore
index f1e859b..e2943c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,9 @@
 # See https://help.github.com/ignore-files/ for more about ignoring files.
 
+
 # compiled output
+public/assets/tailwind.css
+
 /dist/
 /tmp/
 
diff --git a/app/index.html b/app/index.html
index f5cc3b9..dc86628 100644
--- a/app/index.html
+++ b/app/index.html
@@ -8,6 +8,7 @@
 
     {{content-for "head"}}
 
+    <link integrity="" rel="stylesheet" href="{{rootURL}}assets/tailwind.css">
     <link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
     <link integrity="" rel="stylesheet" href="{{rootURL}}assets/my-app.css">
 
diff --git a/package.json b/package.json
index 2a917a2..497d1d9 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
     "test": "tests"
   },
   "scripts": {
-    "build": "ember build --environment=production",
+    "build": "npm run tailwind:build && ember build --environment=production",
     "lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
     "lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
     "lint:hbs": "ember-template-lint .",
@@ -20,7 +20,9 @@
     "lint:js:fix": "eslint . --fix",
     "start": "ember serve",
     "test": "npm-run-all lint test:*",
-    "test:ember": "ember test"
+    "test:ember": "ember test",
+    "tailwind:build": "npx tailwindcss -c ./config/tailwind/tailwind.config.js -i ./config/tailwind/tailwind-input.css -o ./public/assets/tailwind.css",
+    "tailwind:watch": "npx tailwindcss -c ./config/tailwind/tailwind.config.js -i ./config/tailwind/tailwind-input.css -o ./public/assets/tailwind.css --watch"
   },
   "devDependencies": {
     "@ember/optional-features": "^2.0.0",
@@ -59,7 +61,8 @@
     "prettier": "^2.6.1",
     "qunit": "^2.18.0",
     "qunit-dom": "^2.0.0",
-    "webpack": "^5.70.0"
+    "webpack": "^5.70.0",
+    "tailwindcss": "^3.0.0"
   },
   "engines": {}

@jacobq
Copy link
Contributor

jacobq commented Apr 29, 2022

however! if someone wants to add windows to the C.I. for this repo, that'd be hugely appreciated.

(Taking a shot at this in PR #262 )
I'm not sure how to easily run/test GH actions on a fork...However, it looks like I need approval since I've not contributed to this repo before. @NullVoxPopuli can you authorize? Edit: I modified the workflow on the main branch of my fork and added the branch to the config and now can test on my fork.

@jacobq
Copy link
Contributor

jacobq commented May 2, 2022

I think I figured out why it wasn't working for me on Windows: the resolvePath implementation does not convert absolute Windows paths like C:\foo.js to file://C:\foo.js. See jacobq@a195301

@esbanarango
Copy link

Facing this same issue:

npx ember-apply tailwind
npx: installed 688 in 50.501s
ℹ Skypack unavailable, downloading from npm
✖ Command failed with exit code 1: npm install --omit dev --force

Running in on macOS Monterry.

@esbanarango
Copy link

Tried to play back with this again and got a new error:

npx ember-apply tailwind
npx: installed 704 in 47.738s
ℹ Skypack unavailable, downloading from npm
✖ Cannot find package 'ember-apply' imported from /private/var/folders/jq/k7tk0_dx5yvc0cxl4q3ll7680000gp/T/ember-apply-runtime---WaRUni/index.js
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ember-apply' imported from /private/var/folders/jq/k7tk0_dx5yvc0cxl4q3ll7680000gp/T/ember-apply-runtime---WaRUni/index.js
    at new NodeError (internal/errors.js:322:7)
    at packageResolve (internal/modules/esm/resolve.js:687:9)
    at moduleResolve (internal/modules/esm/resolve.js:728:18)
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:842:11)
    at Loader.resolve (internal/modules/esm/loader.js:89:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:242:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:76:40)
    at link (internal/modules/esm/module_job.js:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

@NullVoxPopuli
Copy link
Owner

what node version are you using?

@esbanarango
Copy link

what node version are you using?

v14.18.1

@NullVoxPopuli
Copy link
Owner

Does it work with 18?

@NullVoxPopuli
Copy link
Owner

Gonna close for now -- Node 14 is EOL'd as of 30 April, 2023.

If this issue is still present on newer nodes, can someone re-open with their newer node version? thanks!!

@MichalBryxi
Copy link
Sponsor Contributor Author

MichalBryxi commented Aug 18, 2024

Documenting for if some unfortunate soul bumps into this: Got the issue of:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ember-apply' imported from ...

Again on localhost despite me running the command as:

pnpm exec ember-apply tailwind-webpack

The thing is that for some reason my version of npm was:

npm --version
6.14.16

The problem was (probably) because nvm / n / volta / ... leaving out my system polluted with some misconfigured versions. I found out that running brew postinstall with debug flag on node would yell:

brew postinstall node --debug
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading node
/usr/local/Homebrew/Library/Homebrew/brew.rb (Formulary::FromAPILoader): loading homebrew/core/node
==> Postinstalling node
Warning: The post-install step did not complete successfully
You can try again using:
  brew postinstall node
==> An exception occurred within a child process:
  Errno::EACCES: Permission denied @ apply2files - /usr/local/lib/node_modules/npm/.npmignore

/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2330:in `unlink'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2330:in `block in remove_file'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2335:in `platform_support'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2329:in `remove_file'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2318:in `remove'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:1452:in `block in remove_entry'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2377:in `block (2 levels) in postorder_traverse'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2381:in `postorder_traverse'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2376:in `block in postorder_traverse'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2375:in `each'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:2375:in `postorder_traverse'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:1450:in `remove_entry'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:1307:in `block in rm_r'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:1303:in `each'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/3.3.4_1/lib/ruby/3.3.0/fileutils.rb:1303:in `rm_r'
/usr/local/opt/node/.brew/node.rb:116:in `post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1415:in `block (2 levels) in run_post_install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1193:in `with_logging'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1414:in `block in run_post_install'
/usr/local/Homebrew/Library/Homebrew/extend/kernel.rb:536:in `with_env'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1410:in `run_post_install'
/usr/local/Homebrew/Library/Homebrew/postinstall.rb:29:in `<main>'

So after some poking around I found that the fix would be to run following. Note: This will very likely work only on OSX. For other OS you will need to adjust the process to fix. Obviously exchange michal for whatever the output of whoami command is.

sudo chown -R michal:staff /usr/local/lib/node_modules/

And then the brew command again:

brew postinstall node --debug

Which would then yield:

npm --version
10.8.2

And after that everything works again \o/

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

4 participants