I went through the process of installing the VolumioUI on Ubuntu
as explained in this link.
and I get:
/Volumio2-UI$ gulp serve --theme="volumio"
/home/yossi/elia/Volumio2-UI/gulp/build.js:127
fs.readFileSync(`${conf.paths.src}/app/themes/${themeSelected}/assets/va
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
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)
at require (module.js:380:17)
at /home/yossi/elia/Volumio2-UI/gulpfile.js:19:3
at Array.map (native)
at Object.<anonymous> (/home/yossi/elia/Volumio2-UI/gulpfile.js:18:4)
at Module._compile (module.js:456:26)
I did the same process on MAC with no problems.
This is very strange since it complains about a syntax error.
if I change it to ' than it works fine, the problem is that the code is full of this error.
Can I config NodeJs to treat ` as '
?
Note: I was able to solve it by search-and-replace, but I leave this question open because I would like to know if it can be solved with a config
$ node --version
v0.10.25
Backticks are part of the new syntax introduced in the latest version of Javascript (ES6).
The problem occurs, because you have a (very) old version of node, which does not implement this new syntax. Probably, you have node v.0.10 instead of node v.7
The solution is to upgrade node.js.
Here is how (Ubuntu 14), see https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/nodejs
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
This is the solucion with the problem for Invalid or unexpected token when you use npm install.
Backticks are different from single quotes, they aren't interchangeable by means of setting a configuration option somewhere.
You need a relatively recent Node.js version (v4.4.2 or up, I think) that supports the backtick ("template literal") syntax.
Related
When trying to install Ember.js on Windows (and possibly other systems), after running the following commands:
npm install -g npm
npm install -g ember-cli
npm install -g bower
No errors are raised, how the command ember -v outputs the following:
C:\Users\<user>\AppData\Roaming\npm\node_modules\ember-cli\lib\cli\index.js:3
const willInterruptProcess = require('../utilities/will-interrupt-process');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\bin\ember:26:11
at C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\node_modules\resolve\lib\async.js:50:13
at processDirs (C:\Users\Shayn\AppData\Roaming\npm\node_modules\ember-cli\node_modules\resolve\lib\async.js:182:39)
This suggests an issue with my Ember installation, how can I address this?
The solution is suggested in a few other answers, for example this one, however this exact solution will not work on Windows.
Instead, the best solution is to get the latest version of Node installed via an installer.
To verify after installation try the following:
node --version
Which should output something like:
v8.9.1
Previously this command would have given a lower version number. In my case it was similar to v0.12.
I'm new to mean stack world, I installed mongoDB and nodejs
node -v => v4.4.3
npm -v => 2.15.1
mongo -version => MongoDB shell version: 3.2.6
then followed MEAN installation guide to install it.
after many faults I can run gult and have a response.
now when ever I try to run any command with mean, I get following error:
module.js:327
throw err;
^
Error: Cannot find module 'request'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/lib/node_modules/mean-cli/lib/controllers/anonymized-data.js:8:12)
at Module._compile (module.js:409:26)
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)
I tried with: sudo npm install request
but still getting same issue !! can any one guide me please? thanks in advance
UPDATE
after running command given by #Alexander Mac, I got following result
it's still same status :( . and without sudo I got lots or errors #Seth :P
Alex is right about 'request' not being part of the package. That said, instead of messing out with the install manually, it might be far easier to install a previous known good version
For e.g., you can try: sudo npm i -g mean-cli#0.12.1
mean-cli package has a bug. The authors forget to include request module in package.json: look here. You can create an issue about that on their site.
To resolve the problem locally go to /usr/lib/node_modules/mean-cli and run: sudo npm i request to install missing request module.
I use nvm to manage node.
I go to /home/ougwen1235/.nvm/versions/node/v4.2.4/lib/node_modules/mean-cli and run npm install request --save.Then, the problem was solved.
I am trying to login on facebook.com with selenium-webdriver.
var webdriver = require('selenium-webdriver'),
By = require('selenium-webdriver').By,
until = require('selenium-webdriver').until;
var driver = new webdriver.Builder()
.forBrowser('firefox')
.build();
driver.get('https://www.facebook.com/login');
driver.findElement(By.id('email')).sendKeys('****');
driver.findElement(By.id('pass')).sendKeys('*****');
driver.findElement(By.id('loginbutton')).click();
driver.findElement(By.linkText('Settings')).then(function(element) {
console.log('Yes, found the element');
}, function(error) {
console.log('The element was not found, as expected');
});
driver.quit();
It is giving error:
/home/shubham/node_modules/selenium-webdriver/index.js:25
const builder = require('./builder');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
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)
at require (module.js:380:17)
at Object.<anonymous> (/home/shubham/Music/amazon_login/test_22_4_16/sel_login.js:1:79)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
node --version v0.10.37
npm --version1.4.28
protractor --version Version 3.2.2
selenium-webdriver#2.53.1
Updating nodejs solved the issue:
npm cache clean -f
sudo npm install -g n
sudo n stable
node --version
node app.js
You have to run the second and third command as root/administrator.
n stable wouldn't do the trick for me. On the other hand,
nvm install stable
That actually got me to last nodejs version. Apparently n stable won't get pass v0.12.14 for me. I really don't know why.
Note: nvm is Node Version Manager, you can install it from its github page. Thanks #isaiah for noting that nvm is not a known command.
For me it was more simple to solve, just going to the Node web site, get and install the LTS version.
Update your node and it will resolve this problem.
Updating NodeJS solves this problem.
But, after running sudo npm install -g n you might get following error:
npm: relocation error: npm: symbol SSL_set_cert_cb, version libssl.so.10 not defined in file libssl.so.10 with link time reference
In order to overcome this error, try upgrading openssl using the below command:
sudo yum update openssl
That error means your node's publish is low than the need.
carefully to update the node of your computer.
In Linux Mint, I've installed node and used it to install typescript. With a working typescript installation, tsc --version should return the version number. In my case, nothing is returned at all.
When I run which tsc the result is /usr/local/bin/tsc.
When I run cat /usr/local/bin/tsc the result is:
#!/usr/bin/env node
require('../lib/tsc.js')
When I run find /usr/local -name 'tsc*' the result is:
/usr/local/bin/tsc
/usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/lib/node_modules/typescript/lib/tsc.js
Does that look correct? If so, then any ideas on what else to look at would be appreciated?
Note I also tried running /usr/local/lib/node_modules/typescript/bin/tsc --version and got the same result ie nothing.
In my case on Ubuntu 16.04 the problem was because of I performed sudo apt-get install node-typescript, which delivered me broken tsc. After removing it via apt-get remove and then installing as recommended with npm install -g typescript, it worked fine.
Maybe this will help someone.
I discovered that running node --version returns nothing (but shouldn't) however nodejs --version works (the result being v0.10.25). Reinstalling node didn't fix this. I don't know why this would be the case, as I think I followed the recommended installation procedure.
However, editing file /usr/local/bin/tsc and changing the line:
#!/usr/bin/env node
to
#!/usr/bin/env nodejs
seemed to work. Now tsc --version returns message TS6029: Version 1.6.2 and I'm getting .js files generated when I run make.
I was getting the following error in Ubuntu 16.04.6 :
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'typescript/tsc.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/usr/bin/tsc:2:1)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
Running : npm install -g typescript didn't resolved the issue.
So, I had to install the latest version of node i.e nvm install <nvm version>
Then with npm install , it fixed the issue.
I think I have installed node.js before but never used homebrew to do it. Today I tried to do a walkthrough of an application but got stuck at the very beginning. I am fairly new to programming so I am utterly confused as to why I can't get this to work.
I have tried a lot of things but can't seem to find the answer.
These are the commands I run in order to install the MEAN stack:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
(succesful no errors)
brew install node
(succesfull no errors)
I check if node has installed properly by typing:
node -v
v0.12.4
I then check if npm is installed properly by typing:
npm -v
Here is the error message:
module.js:338
throw err;
^
Error: Cannot find module './cache/caching-client.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /usr/local/lib/node_modules/npm/lib/npm.js:22:24
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:466:3)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
I have installed node in a different way other than using Homebrew and maybe that is messing things up. Please let me know your thoughts.
What I have tried to do so far is uninstall node and reinstall it using this process:
https://gist.github.com/DanHerbert/9520689
Maybe you've already fixed, but the answer might serve others.
I tried what is in the post that Mario linked to in his comment, but it didn't work. It just so happens that my npm is installed at /Users/USERNAME/.node/bin/, so I added the following line in my .bash_profile file: export PATH="$HOME/.node/bin:$PATH".
In my case it was caused by me installing node with root and later with brew (without root).
As a result brew was not able to override the old npm files upon upgrading.
Manually removing the old node installation worked for me.