Squiffy problem: /usr/bin/env: ‘node\r’: No such file or directory

hi guyss, i'm trying to instal squiffy in my ubuntu 16.04 by following this method:
http://docs.textadventures.co.uk/squiffy/cli.html
but after the installation and i tried to use >squiffy mygame.squiffy, all i got is:
/usr/bin/env: ‘node\r’: No such file or directory
can you twroubleshoot this problem?


K.V.

(This is totally a guess.)

Do you have node installed?

To check:

which node

should give you:

/usr/bin/node

UPDATE

That's probably no help.

What prints when you just enter squiffy?


Hii, KV, thanks for replying, i tried your suggestion by typing >which node and it doesn't give me anything, and command >which alone gives me mothing...

So itried to use ubuntu nautilus to explore to /usr/bin/ and i couldn't find node but i found node-gyp and nodejs.

And when i tried >squiffy, it showed /usr/bin/env: ‘node\r’: No such file or directory...


Oh and i've installed nodejs via apt as I remember, and for installing squiffy itself i used nmp install squiffy...

I downloaded squiffy for linux, squiffy.5
1.1.Linux.zip but I don't know what i should do with that so i installed squiffy via nmp instal instead (http://docs.textadventures.co.uk/squiffy/cli.html)

PS. I'm totally newbie for both ubuntu & squiffy keke.


K.V.

which is an awesome *Nix command which tells where and if a program is installed.

Try:

which squiffy

If you didn't enter the code like this when you tried to install it: sudo npm install squiffy -g, it didn't actually install Squiffy to your system...

Or something could have gone awry...


When you search for something with which, it returns nothing if the program is not installed.


If you're not a Linux command-line expert, you probably just want to unzip this:

https://github.com/textadventures/squiffy-editor/releases/download/v5.1.1/Squiffy.5.1.1.Linux.zip

...which you said you've already downloaded.

Do you have a Desktop environment? (I assume so, unless you're bare-bonesing it with Ubuntu.)

Have you right-clicked that file?

It should have an extract files option.

If not, you can do this (from the Downloads directory, if that's where the zip file is):
7za -e Squiffy.5.1.1.Linux.zip -o Squiffy511

(You may need to install p7zip-full, but I'm pretty sure Ubuntu has it built-in.)


However you unzip it, unzip it.

Then open the newly created directory and open Squiffy.


SIDE-QUESTION:

Have you tried out Linux Mint?

It's built on Ubuntu, so it has identical capabilities (I think), but I find it much easier to navigate and use than Ubuntu.


Yup i've tried to extraxt it, but squiffy didn't seem like excutable file,

And i've already tried linux mint but i find ubuntu has more stuffs in its repo than linux mint has,


K.V.

What does it say when you:

which squiffy

What does it say when you:
which npm


K.V.

Hold on...

Let me see if I still have a Ubuntu ISO somewhere...

I'll switch to it and log back in.


Sorry to bother you, KV. actually you don't have to do this but i do thank you for what you do...

which squiffy

gives me /usr/local/bin/squiffy.
While

which npm

gives me /usr/bin/npm.


K.V.

Oh, it's my pleasure!

Ubuntu and I just don't play well together.

I am downloading stuff at a whopping 17.4 KB/s right now, and have been doing so for hours.

Every other OS I run, I bust at least 150KB/s, but Ubuntu is always trying to download updates and check for updates, and anything else that slows things down. (Just like Windows 10!)


END OF RANT


While I curse Ubuntu, you could try this:

/usr/local/bin/squiffy mygame.squiffy.

You will need to be in the directory which you created the file mygame.squiffy for that code to work.


Appreciate it KV...
so i tried: /usr/local/bin/squiffy coba.squiffy and it still gave me /usr/bin/env: ‘node\r’: No such file or directory.

So i decided to open file squiffy in /usr/local/bin/ using gedit, and this is the contents:

#!/usr/bin/env node
/* jshint quotmark: single */

'use strict';

var path = require('path');
var fs = require('fs');
var compiler = require('./compiler.js');

var packageJson = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json')).toString());
var squiffyVersion = packageJson.version;

function startServer(dir, port) {
    var finalhandler = require('finalhandler');
    var http = require('http');
    var serveStatic = require('serve-static');

    var serve = serveStatic(dir, { index: ['index.html'] });

    var server = http.createServer(function(req, res){
        var done = finalhandler(req, res);
        serve(req, res, done);
    });

    server.listen(port);
}

console.log('Squiffy ' + squiffyVersion);

var argv = require('yargs')
    .usage('Compiles a Squiffy script file into HTML and JavaScript.\nFor help, see http://docs.textadventures.co.uk/squiffy/\nUsage: $0 filename.squiffy [options]')
    .demand(1)
    .alias('c', 'cdn')
    .alias('s', 'serve')
    .alias('p', 'port')
    .describe('c', 'Use CDN for jQuery')
    .describe('s', 'Start HTTP server after compiling')
    .describe('p', 'Port for HTTP server (only with --serve)')
    .describe('scriptonly', 'Only generate JavaScript file (and optionally specify a name)')
    .describe('pluginname', 'Specify the jQuery plugin name instead of .questkit (only with --scriptonly)')
    .describe('zip', 'Create zip file')
    .argv;

var options = {
    useCdn: argv.c,
    serve: argv.s,
    scriptOnly: argv.scriptonly,
    pluginName: argv.pluginname,
    zip: argv.zip,
    write: true,
};

var result = compiler.generate(argv._[0], options);

if (result && options.serve) {
    var port = argv.p || 8282;
    startServer(result, port);
    console.log('Started http://localhost:' + port + '/');
}

perhaps it can give you some clues...


K.V.

When you extracted everything from the zip file you downloaded, did you have these files in the newly created directory?

image


If so, you should be able to just double-click Squiffy:

image


Sorry, I had to give up on installing npm and squiffy in Ubuntu for a while.

I don't like it because it's bloated, purple and bass-ackwards, and it doesn't like me because I talk smack about it.


K.V.

Whoops!

I was typing while you were posting.


Show me your coba.squiffy file's contents, please.


yess there is that squiffy file in extracted downloaded zip files, but when i double clicked, there's pop up window saying:

Could not display "Squiffy"

There is no application for "executable" files.
Do you want to search for an application to open this file?
No/Yes

Is there some application i need that i dont have?


That means you downloaded the Windows version.

Try downloading then extracting this:
https://github.com/textadventures/squiffy-editor/releases/download/v5.1.1/Squiffy.5.1.1.Linux.zip


ALSO

EDITED

/usr/bin/env: ‘node\r’: No such file or directory

After running sudo npm install squiffy -g --verbose, this is all I can get out of it in Linux Mint or Ubuntu, too.

Hrmm...


Have you tried just creating online? (It's basically the same thing as the version in that zip file.)

http://textadventures.co.uk/squiffy/editor


heyy KV & Richard, found the culprit...
So after i googled "There is no application for "executable" files. Do you want to search for an application to open this file?"
i stumbled upon this forum https://ubuntuforums.org/showthread.php?t=1366252, and the problem is actually simple, i just follow these steps:

1. Right-click the file and choose Properties
2. Click on the Permissions-tab
3. Mark the "Allow executing file as program" and then close
4. Double-click the file again

and yesss it does running GUI version... i really thank you guyss especially you KV, for putting hard work solving my problem :)
i love interactive fiction, but i found gamebook a little bit more popular these days, so i'd like to try to make one... thanks again guyss


Hey richard. Yes i tried squiffy online, but well in my country, internet is not that stable nor reliable, last time i need 45 minutes to backup 100 mb files... though i think compiling online is simple and doesn't need that strong stable connection, i'd really love to do it offline...


Ah...

You had to to make it executable...

(Damn and blast! I should have suggested that!)

Glad you got it working!

(And my internet sucks too, so don't feel too bad!)


K.V.

Great!

Look at you go!

You'll be a Ubuntu master in no time!


As if i always got luck by my side every time keke... The title of this discussion seems irrelevant now but i can't change it...


K.V.

Hey,

I just figured out how to make the CLI version work!

Ubuntu doesn't like the Windows line-endings.

Gotta change them!

https://stackoverflow.com/questions/16768776/convert-line-endings


This is the method I used:

kv@kv-Lenovo ~ $ squiffy
/usr/bin/env: ‘node\r’: No such file or directory
kv@kv-Lenovo ~ $ sudo su
kv-Lenovo kv # cp /usr/local/bin/squiffy /usr/local/bin/squiffybak
kv-Lenovo kv # sed 's/\r$//' /usr/local/bin/squiffybak > /usr/local/bin/squiffy
kv-Lenovo kv # squiffy
Squiffy 5.1.2
Compiles a Squiffy script file into HTML and JavaScript.
For help, see http://docs.textadventures.co.uk/squiffy/
Usage: /usr/local/bin/squiffy filename.squiffy [options]

Options:
  -c, --cdn     Use CDN for jQuery                                                          
  -s, --serve   Start HTTP server after compiling                                           
  -p, --port    Port for HTTP server (only with --serve)                                    
  --scriptonly  Only generate JavaScript file (and optionally specify a name)               
  --pluginname  Specify the jQuery plugin name instead of .questkit (only with --scriptonly)
  --zip         Create zip file                                                             

Not enough non-option arguments: got 0, need at least 1
kv-Lenovo kv # exit
exit
kv@kv-Lenovo ~ $ echo -e "This is just an [example] to test-compile.\n [example]:\nThat means it is not really a game!" > tester.squiffy
kv@kv-Lenovo ~ $ squiffy tester.squiffy 
Squiffy 5.1.2
Loading /home/kv/tester.squiffy
Writing story.js
Writing index.html
Writing style.css
Done.


K.V.

Strangely, it works as installed in Arch Linux, but not in anything else I have that is Ubuntu-based.


K.V.

PS (and off-topic)

You should play around with Questkit, too.

You can install it with sudo npm install questkit -g --verbose.

Then, you can write quasi-Quest text-adventures in YAML, and play them in the terminal!


I give up on using CLI version... Way to complicated & i think it will leave some invisible residual since i'm not good at CLI...

But is it possible to use quest on linux CLI, isn't quest windows exclusive?


Does CLI quest have some features squiffy didn't, like adding sound and images?

If it does, it's worth working on terminal


K.V.

Quest depends on quite a few Windows-specific things.

I've got one of my Linux Mint machines to tje point where it will create and edit Quest games under Wine, but I can't get the player to work. BUT you can just submit a compiled game to this site to play online, so...

Meh.

Still. Just pretend I said, "no Quest on Linux, except online."


K.V.

You can add sound, images, video, etc. in Squiffy.

You just use HTML or JS.


Questkit is a very, very bare-bones text-adventure compiler.

I only advise it for playing around or learning to code in YAML.


I guess i'll stick with squiffy, So, html and JS are inevitable these days... Appreciate the advice KV...


K.V.

Squiffy compiles your story to HTML, CSS, and JS (a website).


I had a similar problem (running Mint, an Ubuntu derivative). The problem is DOS line-ending chars in the squiffy executable.

I solved it by installing dos2unix and using it on the squiffy exec:

squiffy is /usr/local/bin/squiffy
$ ls -l /usr/local/bin/squiffy
lrwxrwxrwx 1 root root 38 Feb 18 12:31 /usr/local/bin/squiffy -> ../lib/node_modules/squiffy/squiffy.js

That tells you where squiffy is installed (here, /usr/local/lib/node_modules/squiffy/squiffy.js). Now, fix the line ending

$ sudo apt-get install dos2unix
[usual output]
$ sudo dos2unix  /usr/local/lib/node_modules/squiffy/squiffy.js
dos2unix: converting file /usr/local/lib/node_modules/squiffy/squiffy.js to Unix format ...

All done.


K.V.

That's basically what I did here:

http://textadventures.co.uk/forum/squiffy/topic/nh9e-4pyneicwxuwvpctzg/squiffy-problem-usr-bin-env-node-r-no-such-file-or-directory#faa7eac2-12d6-4f48-a803-05792df17ee9


Sadly, I already had dos2unix installed and didn't even think to use it.

I just used sed to cut out every instance of \r, which is what makes the line-endings Windows line-endings.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums