Development Tools Install and Use Sequelize CLI

Truman Smith
Truman Smith
Full Stack JavaScript Techdegree Student 13,641 Points

unable to edit the www file

Not a question. Sharing a problem and workaround that I experienced...

In the Treehouse workspace I renamed www to www.js, but when attempting to save the file I got a "workspace connection lost" message then when the workspace was restored the edit was not saved. At another time the workspace would not display www.js file's contents the tab.

Eventually I discovered that I could edit and save if I renamed the file to www.txt.

Don't know if it's OS related. I'm on Mac OS 10.14

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 45,186 Points

I was able to rename the file www.js and the preview went from none available to:

#!/usr/bin/env node

/**
 * Module dependencies.
 */

var app = require('../app');
var debug = require('debug')('blog:server');
var http = require('http');

/**
 * Get port from environment and store in Express.
 */

var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);

/**
 * Create HTTP server.
 */

var server = http.createServer(app);

/**
 * Listen on provided port, on all network interfaces.
 */

server.listen(port);
server.on('error', onError);
server.on('listening', onListening);

/**
 * Normalize a port into a number, string, or false.
 */

function normalizePort(val) {
  var port = parseInt(val, 10);

  if (isNaN(port)) {
    // named pipe
    return val;
  }

  if (port >= 0) {
    // port number
    return port;
  }

  return false;
}

/**
 * Event listener for HTTP server "error" event.
 */

function onError(error) {
  if (error.syscall !== 'listen') {
    throw error;
  }

  var bind = typeof port === 'string'
    ? 'Pipe ' + port
    : 'Port ' + port;

  // handle specific listen errors with friendly messages
  switch (error.code) {
    case 'EACCES':
      console.error(bind + ' requires elevated privileges');
      process.exit(1);
      break;
    case 'EADDRINUSE':
      console.error(bind + ' is already in use');
      process.exit(1);
      break;
    default:
      throw error;
  }
}

/**
 * Event listener for HTTP server "listening" event.
 */

function onListening() {
  var addr = server.address();
  var bind = typeof addr === 'string'
    ? 'pipe ' + addr
    : 'port ' + addr.port;
  debug('Listening on ' + bind);
}
Brian Kidd
Brian Kidd
Full Stack JavaScript Techdegree Student 19,676 Points

I had the same issue, but by refreshing the entire page and not just the workspace I was able to edit the www file by renaming it www.js.