Skip to content

"Could not load TypeScript. Try installing with npm install -g typescript" #35

@ldminoc

Description

@ldminoc

I updated to 0.5.2 from 0.5.0 this morning but still seem to be having the same issue although the new error message is less useful for problem identification. After receiving the error message, I updated typescript to the latest nightly build using 'npm install -g typescript@next'.

Any insights would be appreciated.

Here's my webpack.config.js:

'use strict';

var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');

module.exports = {
  entry: './server/server.ts',
  output: {
    path: './build/',
    filename: 'server.js'
  },
  plugins: [
    new webpack.optimize.OccurenceOrderPlugin(),
    new WebpackNotifierPlugin()
  ],
  resolve: {
    extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.ts', '.tsx']
  },
  module: {
    loaders: [
      {
        test: /\.jsx$/,
        exclude: ['./node_modules/'],
        loader: 'babel-loader'
      },
      {
        test: /\.ts(x?)$/,
        exclude: ['./node_modules/'],
        loader: 'ts-loader'
      }
    ]
  }
};

And here is the tsconfig.js:

{
    "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": true,
        "removeComments": true,
        "preserveConstEnums": true,
        "target": "ES5",
        "sourceMap": true
    }
}

With 0.5.0, the error message was:
ERROR in ./server/server.ts

Module build failed: Error: Cannot find module 'typescript'
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 ensureTypeScriptInstance (partial path elided .../node_modules/ts-loader/index.js:69:20)
at Object.loader (partial path elided .../node_modules/ts-loader/index.js:228:14)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions