Yeoman Error: Cannot find module 'escape-string-regexp' - yeoman

I'm trying to generate a app with generator-gulp-webapp by running yo gulp-webapp, though when I do I get the following error:
Deans-Air:deangibson deang$ sudo yo gulp-webapp
module.js:339
throw err;
^
Error: Cannot find module 'escape-string-regexp'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/chalk/index.js:2:26)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
Deans-Air:deangibson deang$

Ran into the same issue today. I found an error cannot run in wd %s %s towards the top of the stack. Re running the $ sudo npm install -g mean-cli command with the --unsafe-perm flag fixed it for me.
Node: v0.12.2
NPM: 3.5.0

Related

Getting unexpected token error in appium doctor

I have installed appium doctor and got it installed without error on mac. However when I used command "appium-doctor -h" to check. It gives following exception. Can you please let me know what is going wrong here:
appium-doctor -h
/usr/local/lib/node_modules/appium-doctor/build/lib/general.js:59
catch {
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/appium-doctor/lib/factory.js:3:1)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/appium-doctor/bin/appium-doctor.js:4:1)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
This issue related to the node version, please try to install the latest version of the node recommended version from below link
Node Latest Version v12.13.0
I am also facing the same issue, once upgraded to the recommended/latest version of the version node problem solved.
If not resolved post the error here will do further debugging.
Run these commands it will solve the issue:
sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
source ~/.profile
nvm ls-remote
nvm install v12.16.2
nvm use v12.16.2
node -v

Cannot find module './accelerometer'

I'm getting the below error when trying to run johnny-five on my tessel 2:
Error: Cannot find module './accelerometer'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/tmp/remote-script/node_modules/johnny-five/lib/johnny-five.js:1:152)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I've tried installing the module but the error still appears.
Any pointers please would be greatly appreciated.
Try installing Node version 8.11.1.
It worked for me. Took two days to figure it out.
If it doesn't work, check the version the package.json is on tessel-io and johnny-five. If the node version in the package.json is different from the node version you're using, update it or downgrade it to that package.json node version.

YO - unexpected token error

Running yo gives invalid token error. Currently using Node, NPM versions as given below.
node -v
v4.5.0
npm -v
2.15.9
$ yo
node_modules/yo/node_modules/yeoman-environment/lib/resolver.js
let lookup = path.join(...parts.slice(0, i + 1), 'node_modules');
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous>
things worked after moving to node -v v8.11.1 and npm -v 5.6.0

unable to create filter and directives in angular fullstack project

I am using angular-fullstack yeoman generator and added some dependencies to my bower.json. I have then sudo npm install and bower install. Now when I run the command yo angular-fullstack:directive simple or yo angular-fullstack:filter propsFilter I get the below error:
Error: Cannot find module 'file-utils'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-angular-fullstack/node_modules/yeoman-generator/lib/base.js:11:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Try reinstalling (maybe uninstall/reinstall).
Given your trace, it looks like npm install broke and didn't install dependencies correctly. I've had this issue a lot switching to npm 3 and running install/update command over a previously installed package.

Yeoman generator error

When I try to run yo app generator I get this error:
/Users/coder/.node/lib/node_modules/yo/node_modules/yeoman-environment/node_modules/inquirer/node_modules/rx/dist/rx.all.js:9229
throw e;
^
Error: Cannot find module 'yeoman-generator'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/coder/.node/lib/node_modules/generator-webapp/app/index.js:4:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Params:
os OS X Yosemite 10.10,
yo 1.3.3,
node v0.10.32
Update npm an re-run npm install. There's probably been an issue during the installation process causing one module to not be installed.
Nothing else you can do about this.

Resources