yo webapp generator is installed but not recognized? - yeoman

I try to install the webapp generator from yeoman but I have got this error :
You don't seem to have a generator with the name webapp installed.
after yo webapp :
npm install -g yo (works fine)
npm install -g generator-webapp (works fine)
yo webapp (does not work)
Here is the command lines (on Mac Os) :
MBP-de-Empon:yo Empon$ npm install -g yo
npm WARN deprecated npmconf#2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/Users/Empon/npm/bin/yo-complete -> /Users/Empon/npm/lib/node_modules/yo/lib/completion/index.js
/Users/Empon/npm/bin/yo -> /Users/Empon/npm/lib/node_modules/yo/lib/cli.js
> yo#1.8.5 postinstall /Users/Empon/npm/lib/node_modules/yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ NODE_PATH matches the npm root
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
Everything looks all right!
/Users/Empon/npm/lib
└── yo#1.8.5
MBP-de-Empon:yo Empon$ npm install -g generator-webapp
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/Users/Empon/npm/lib
└── generator-webapp#2.4.1
MBP-de-Empon:yo Empon$ yo webapp
Error webapp
You don't seem to have a generator with the name webapp installed.
You can see available generators with npm search yeoman-generator and then install them with npm install [name].
To see the 14 registered generators run yo with the `--help` option.
MBP-de-Empon:yo Empon$
EDIT :
So yeoman searched at usr/local... and the webapp generator was downloaded at /Users/Empon/...
So I copied the content into a new folder with the same name : generator-webapp:
mkdir generator-webapp
cp -a /Users/Empon/npm/lib/node_modules/generator-webapp/. /usr/local/lib/node_modules/generator-webapp/
I tried again yo webapp, and I have got this error now :
So it looks good until this line :
events.js:141
throw er; // Unhandled 'error' event
and a new line appear on the Terminal and I was not being able to complete the sass options :
MBP-de-Empon:yo Empon$ yo webapp
_-----_ ╭──────────────────────────╮
| | │ 'Allo 'allo! Out of the │
|--(o)--| │ box I include HTML5 │
`---------´ │ Boilerplate, jQuery, and │
( _´U`_ ) │ a gulpfile to build your │
/___A___\ /│ app. │
| ~ | ╰──────────────────────────╯
__'.___.'__
´ ` |° ´ Y `
? Which additional features would you like to include? (Press <space> to select)
❯◉ Sass
◉ Bootstrap
◉ Modernizr
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: this.env.adapter.prompt(...).then is not a function
at Base.prompt (/usr/local/lib/node_modules/generator-webapp/node_modules/yeoman-generator/lib/base.js:240:45)
at module.exports.generators.Base.extend.prompting (/usr/local/lib/node_modules/generator-webapp/app/index.js:102:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-webapp/node_modules/yeoman-generator/lib/base.js:439:23)
at /usr/local/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/run-async/index.js:25:25
at /usr/local/lib/node_modules/generator-webapp/node_modules/yeoman-generator/node_modules/run-async/index.js:24:19
at /usr/local/lib/node_modules/generator-webapp/node_modules/yeoman-generator/lib/base.js:440:9
at processImmediate [as _immediateCallback] (timers.js:383:17)
MBP-de-Empon:yo Empon$

Related

npm throws Unknown command: "set-script" when creating new Ruby on Rails project

I am trying to create new Ruby on Rails project with:
rails new project -v 7.0.4 --css=sass --javascript=esbuild --database=mysql
And I get:
...
Add build script
run npm set-script build "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets" from "."
Unknown command: "set-script"
Did you mean this?
npm run-script # Run arbitrary package scripts
...
npm version:
% npm -v
9.1.2
% which npm
/Users/foo/.nvm/versions/node/v19.1.0/bin/npm
Interesting is that nvm help doesn't even show set-script in "All commands" list.
I am on Mac M2, not sure if relevant.
I didn't find anything on google.
set-script has been deprecated as per documentation
The below should work
npm pkg set scripts.build="esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets"

How to ignore files or directories with clang-format 3.9

I am currently using travis ci to check patches as they come into github and am trying to figure out if there is anyway for clang-format 3.9 (since travis ci will only support ubuntu 14.04 currently as latest) to ignore entire directories or files when scanning changes.
My .travis.yml file:
language: c++
sudo: required
dist: trusty
install:
- sudo apt-get update
- sudo apt-get install clang-format-3.9 python3
- ./travisci/check_patch.py
My travisci/check_patch.py file:
#!/usr/bin/env python3
from subprocess import Popen, PIPE, STDOUT
# Run clang to check if code changes cause a diff output and return 1 if so.
cmd = "git show origin/master..# | clang-format-diff-3.9 -p 1 -style=file"
diff = Popen(cmd, stdout=PIPE, shell=True).communicate()[0]
if diff:
print("Code formatting is not according to style guidelines. Read https://github.com/intel/IA-Hardware-Composer/wiki/Contributions#coding_style")
exit(1)
exit(0)
Individual files no, but directories, yes.
As said here, you can put a new .clang-format-file inside a folder that contains files not to be formatted.
Example: I have a project that includes a header-only library, such as cppzmq and I want only my source files to be formatted to keep the diff small when updating the library. So I create a layout such as:
project/
├ include/
│ ├ 3rdparty/
│ │ ├ .clang-format (1)
│ │ └ zmq.hpp
│ └ my_app.hpp
├ src/
│ └ my_app.cpp
└ .clang-format (2)
Where the first .clang-format holds:
{
"DisableFormat": true,
"SortIncludes": "Never" // with clang-format version < 13 use `false` here.
}
(DisableFormat does not seem to disable include-sorting, so it has to be given explicitly.)
The second .clang-format holds your usual clang-format config.
Make sure your global-/project-level clang-format's style setting is set to File.
Edit: If your clang-format complains about an invalid value on the second line, add a trailing comma:
{
"DisableFormat": true,
"SortIncludes": "Never",
}
or use YAML syntax instead of JSON:
DisableFormat: true
SortIncludes: Never
Check my answer here: https://stackoverflow.com/a/51793637/2751261. Basically I use a find script to select files and folders regarding my criteria and then applying clang-format to each of them. This is because so far I never found any option in clang-format for this.
I know it is not the answer you expect, but I hope it's handy.

ERROR: when installing electron?

When i am installing Electron using npm install electron-prebuilt --save-dev, I am getting the following error:
Error: end of central directory record signature not found
at C:\Users\madhava\Desktop\New folder\node_modules\electron-prebuilt\node_modules\extract-zip\node_modules\yauzl\index.js:98:14
at C:\Users\madhava\Desktop\New folder\node_modules\electron-prebuilt\node_modules\extract-zip\node_modules\yauzl\index.js:342:5
at C:\Users\madhava\Desktop\New folder\node_modules\electron-prebuilt\node_modules\extract-zip\node_modules\yauzl\node_modules\fd-slicer\index.js:32:7
at FSReqWrap.wrapper [as oncomplete] (fs.js:527:17)
npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install" "electron-prebuilt" "--save-dev"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.27.3 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.27.3 postinstall script 'node install
.js'.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\madhava\Desktop\New folder\npm-debug.log
I had this problem when trying to install on a dodgy connection, which meant I had some bad zips left over. Solution was (on OSX at least to remove the ~/.electron folder, and run npm install electron-prebuilt again. Not sure where the zips get saved to on Windows though.
This is error is because the version of glibc on your host is too old for some of electron's dependencies. Looks like you're using Windows. I ran into this issue with Debian Wheezy The only solution I found was to install a newer version of glibc via this hack:
How to upgrade glibc from version 2.13 to 2.15 on Debian?
You'll need to do something similar with windows.
I had the same issue when i was installing electron globally.here is what i did
rm -rf ~/.electron/
rm -rf ~/.atom/
npm cache clear
npm install
after this I ran the command again..
npm install electron -g
if this doesn't work,you can use the prebuilt version
npm install electron-prebuilt
Here is the resource i used..

Cordova Build fails on OS X with EACCES & ENOENT

I recently started building iOS apps using Cordova and I’ve hit a roadblock. After installing nodeJS, git and cordova (with sudo), I created my first app in the Documents folder of my user account.
The first run went perfectly. Everything worked, and adding my dev account to Xcode helped my app to run on the device. I decided I’d spice things up a bit by adding a “before_prepare” hook called 001_c.js in <appName>/hooks/before_prepare folder. This is how the hook begins:
//This is where nodeJS exists
#!/usr/local/bin node
console.log("Changing config");
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
//and so on
When I now build the app, I get this error:
pc295786:master kellster$ cordova build ios Running command:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
/Users/kellster/documents/apps/master Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1155:11)
at Object.exports.spawn (child_process.js:988:9)
at Object.exports.spawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:104:31)
at runScriptViaChildProcessSpawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:23)
at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:131:16)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:114:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
To troubleshoot, I changed the first line of the hook script from
#!/usr/local/bin node
to
#! node
(Because this worked on Windows. node was in global scope). But, this resulted in an ENOENT error:
pc295786:master kellster $ cordova build ios Running command:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
/Users/kellster/documents/apps/master Error: Hook failed with error
code ENOENT:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:194:23
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
How do I get this to build? I’d appreciate any suggestions I could try.
Some things to note:
(In my desperation, ) I tried running the following commands, because the "EACCES" type of error. But none of them seemed to have any kind of effect on the result. The build was still failing.
sudo chmod 777 “/Users/kellster/documents/apps/master"
sudo chmod 777 “/usr/local/lib”
sudo chmod 777 "/usr/local/bin/"
chmod 777 "/Users/kellster/documents/apps/master/platforms/"
sudo chmod a+rwx "/Users/kellster/Documents/apps/Master/hooks/before_prepare/001_c.js"
sudo chmod a+rwx "/Users/kellster/Documents/apps/Master/"
sudo chown -R kellster /usr/local/lib/node_modules/cordova
2) Node is installed in
/usr/local/bin
Old answer: #!/usr/local/bin node -> better #!/usr/bin/env node
Updated answer: do not use spaces for referencing node executable instead use:
#!/usr/local/bin/node
Also chmod your script: For example:
chmod 777 hooks/before_prepare/onde.js
where onde.js it is your script. If you're on Mac(my case) or Linux, then your .js must on chmod 777 to avoid EACCES errors.

Installing pow rack server from source on 32bit CPU

Found out about pow just now and trying to install it on a laptop with a 32bit processor. I am running into (hopefully) a minor error.
During the installation from source I get the following error:
*** Installing local configuration files...
mkdir: /Users/username/Library/Application Support: Permission denied
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Command failed: mkdir: /Users/username/Library/Application Support: Permission denied
at ChildProcess.exithandler (child_process.js:102:15)
at ChildProcess.emit (events.js:67:17)
at Socket.<anonymous> (child_process.js:172:12)
at Socket.emit (events.js:64:17)
at Array.<anonymous> (net.js:837:12)
at EventEmitter._tickCallback (node.js:126:26)
pow#0.3.2 /usr/local/lib/node_modules/pow
├── log#1.2.0
├── async#0.1.8
├── coffee-script#1.1.2
├── nack#0.13.1 (netstring#0.2.0)
└── connect#1.7.1
I have tried to change the permissions on the application support folder using:
sudo chmod 777 ~/Library/Application\ Support/
and can verify the permissions using:
ls -la ~/Library/ | less
I get the following:
drwxrwxrwx+ 15 username blah 510 26 Sep 19:16 Application Support
Can anyone point me in the right direction as I seem to have hit a brick wall thanks
From completly unrelated git issue:
sudo chown -R $USER /usr/local/
& then run install without sudo
npm -g install
Worked for me...

Resources