Home Angular 1.6.9 @uiRouter: Error: [ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported
Reply: 0

Angular 1.6.9 @uiRouter: Error: [ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported

user8941 Published in September 20, 2018, 4:43 pm

I am trying to use gulp-browsify to load all the dependencies in one app-release.js file.

The file builds fine but when I try to inject @uiRouter dependency I get the following error in the browser

Where as if I inject angular-route it works fine.

Here is the code


var gulp = require('gulp');
var rename = require('gulp-rename');
var browserify = require('gulp-browserify');
var buffer = require('gulp-buffer');

gulp.task('default', function() {
            insertGlobals: false,
            debug: true


var angular = require('angular');
var uiRouter = require('@uirouter/angularjs');
var ngRoute = require('angular-route');

var app = angular.module("app",[uiRouter]);

app.config(function($stateProvider) {
    var helloState = {
        name: 'hello',
        url: '/',
        template: '<h3>hello world!</h3>'

    var aboutState = {
        name: 'about',
        url: '/about',
        template: '<h3>Its the UI-Router hello world app!</h3>'



<!DOCTYPE html>
<html lang="en" ng-app="app">
    <meta charset="UTF-8">
    <title>Ui Router Test</title>
    <!--<script type="text/javascript" src="/node_modules/angular/angular.js"></script>-->
    <script src="app/app-release.js" type="application/javascript"></script>
<a ui-sref="hello">Hello</a>
<a ui-sref="about">About</a>
<!--<a href="#!red">Red</a>-->
<!--<a href="#!green">Green</a>-->
<!--<a href="#!blue">Blue</a>-->
<!--<div ng-view></div>-->


Thank you for providing help :)

share|improve this question
  • In your index.html file I don't see where you are including the ui-router files? This is usually what causes these errors. – Tyler Feb 13 at 19:33
  • @Tyler I am using browsify by gulp. Which writes all the require dependencies specified in app.js into app-release.js – Alexandra Feb 13 at 20:25
  • Any solutions for this issue? I have the same problem... – w0ns88 May 17 at 13:19
  • @w0ns88 try my answer :) – JonnySerra Jun 3 at 17:43

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.323646 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO