I'm not sure what I've done, but I can no longer compile CoffeeScript files. I keep getting the following, regardless of which file I'm trying to compile. I've tried reinstalling coffee by running sudo npm remove --global coffeescript and then sudo npm install --global coffeescript. Automatic compilation in Atom using the coffee-compile package still works. How can I resolve this?
user#computer:~/some/path $ coffee -c code.coffee
/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:23
({spawn, exec} = require('child_process'));
^
ReferenceError: Invalid left-hand side in assignment
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/coffeescript/bin/coffee:15:5)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
You have CoffeeScript 2+ installed, which requires Node 6 or later; but your Node runtime is < 6. (The error specifically is that the Node runtime chokes on the ({spawn, exec} = destructuring syntax, which Node < 6 doesn’t understand.) Either install CoffeeScript 1.x or Node 6+.
Got the same on Ubuntu 16.04.3 LTS, fixed simply by
$ sudo npm remove --global coffeescript
$ sudo apt-get install coffeescript
Related
UPDATE
I don't have a problem with my ionic module, but with my node install(s).
It seems I have 4 node installs:
running npm start on a createreactapp installed with v15.6.0, I get:
so somehow it is using node 4.5.0.
What’s going on?
Original post:
I have a module, that is malfunctioning. Uninstalling and reinstalling it ultimately results in the same error. And I can see, that uninstalling it doesn't get rid of all the files.
Specifics:
The module in question is Ionic
The error I'm getting ever since I tried to update it is:
/usr/local/lib/node_modules/#ionic/cli/node_modules/semver/internal/re.js:1
(function (exports, require, module, __filename, __dirname) { const { MAX_SAFE_COMPONENT_LENGTH } = require('./constants')
^
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> (/usr/local/lib/node_modules/#ionic/cli/node_modules/semver/index.js:2:20)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
it is shown whenever I run an ionic command, even ionic --help
(btw. this line, that is shown from rs.js is the first line of the file)
I've tried uninstalling it with npm uninstall -g #ionic/cli
and npm uninstall -g ionic
(I also once accidentally typed npm uninstall - ionic. and it did something...)
And reinstalling it with npm install -g #ionic/cli
Tried this several times.
I've also updated node to 15.6.0.
--
I have to admit I'm generally a bit confused about node modules and where they live.
Because for Ionic there are files (I'm using MacOs 11.2.3) in /usr/local/lib/node_modules/#ionic/
But also in [user folder]/node_modules/#ionic
And there's a .ionic in the user folder.
Perhaps there is something I don't understand
How do I go about issues such as this?
I have been working in AngularJS for a while now and I decided to try out Vue. I installed Vue using npm install -g #vue/cli in my terminal using Node version 6.4.0. After the installation was complete I tried creating a new app using vue create <name of app>. It's during this seemingly simple step that I am getting hung up with this error:
/Users/jonalden/.nvm/versions/node/v6.4.0/lib/node_modules/#vue/cli/node_modules/open/index.js:16
const wslToWindowsPath = async path => {
^^^^
SyntaxError: Unexpected identifier
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:528:28)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/jonalden/.nvm/versions/node/v6.4.0/lib/node_modules/#vue/cli/node_modules/#vue/cli-shared-utils/lib/openBrowser.js:9:14)
at Module._compile (module.js:556:32)
I have tried downgrading Node to a previous version and reinstalling Vue with Yarn but both were unsuccessful. One thing throwing me off here is the line wslToWindowsPath, which is especially weird since I am on a Mac.
I had the same problem. I've done this :
sudo rm -rf ~/.nvm
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 keep getting this error message, and I'm unable to trouble-shoot this or see where anyone else is having the same problem.
I followed the instructions to install this on Linux, but audiosprite is producing this error message. Is this an issue with audiosprite? Or nodejs? Or something else?
Using v4.2.6 of node if that matters:
# audiosprite --help
/usr/local/lib/node_modules/audiosprite/audiosprite.js:31
let opts = {}, callback = function(){}
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/audiosprite/cli.js:7:19)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
Upgrade your nodejs and npm version. The keyword let,const are not supported by v4.0. You have to update version
The module n makes version-management easy:
sudo npm install n -g
sudo n 0.12.2
For the latest stable version:
sudo n stable
For the latest version:
sudo n latest
I've found following error when I run grunt test inside my source code Github/Codeship.
In setup command inside codeship, following code are configured like that.
nvm install 0.12.6
nvm use 0.12.6
npm install grunt-cli bower -g
npm install
bower install -p
npm run update-webdriver
and test commands inside codeship;
grunt test
But that error not found inside my source code, and actually found inside github/codeship by viewing following error message given by codeship. Because those folder structure is not defined as we configure in our server. Please help me how to solve it. Thanks.
Using 2 x hasMany to represent N:M relations has been deprecated. Please use belongsToMany instead
>> Mocha exploded!
>> /home/rof/src/github.com/MyProjects/node_modules/sparkpost/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
>> const Hoek = require('hoek');
>> ^^^^^
>> 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 Object.<anonymous> (/home/rof/src/github.com/MyProjects/node_modules/sparkpost/node_modules/request/node_modules/hawk/lib/index.js:5:33)
>> 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)
>> at Module.require (module.js:365:17)
>> at require (module.js:384:17)
>> at Object.<anonymous> (/home/rof/src/github.com/MyProjects/node_modules/sparkpost/node_modules/request/request.js:9:12)
>> at Module._compile (module.js:460:26)
Warning: Task "mochaTest:src" failed. Use --force to continue.
Because those folder structure is not defined as we configure in our server.
This issue has nothing to do with folder structures.
Your project is currently using Node version 0.12.6 which is extremely out of date. The current LTS version of Node is 6.11.3 and the current version is 8.6.0.
The specific issue is SyntaxError: Use of const in strict mode. which means the libraries you are using are currently utilizing ES2015 syntax or higher. The root cause of the issue is in the Boom module, which uses const at line 5 (and most likely other current syntax as well).
The solution for your issue here is to update the node version being utilized inside Codeship.
nvm install 6.11.3
nvm use 6.11.3
simple way. just upgrade your node by below code:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
enjoy!