angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng serve => Error: EPERM: operation not permitted, symlink

Open miroslavhornak opened this issue 10 years ago • 26 comments

I am filing a bug.

  1. OS. Windows 7

  2. Versions. ng --version angular-cli: 0.0.39 node: 4.4.3 os: win32 x64

    node --version
    

    v4.4.3 npm --version 3.8.6 npm info angular-cli { name: 'angular-cli', time: { modified: '2016-05-04T16:29:23.054Z', created: '2014-10-07T04:34:38.078Z', '1.0.0': '2014-10-07T04:34:38.078Z', '0.0.0': '2014-10-11T11:38:24.914Z', '0.0.1': '2015-08-03T17:12:04.553Z', '0.0.2': '2015-10-18T17:46:40.146Z', '0.0.3': '2015-10-18T21:42:52.445Z', '0.0.4': '2015-10-19T01:14:13.216Z', '0.0.5': '2015-10-19T09:14:01.712Z', '0.0.6': '2015-10-19T09:36:51.644Z', '0.0.7': '2015-10-19T11:48:24.233Z', '0.0.8': '2015-10-19T11:51:59.318Z', '0.0.9': '2015-10-19T21:18:13.725Z', '0.0.10': '2015-10-19T22:18:13.091Z', '0.0.11': '2015-11-03T05:03:06.345Z', '0.0.12': '2015-11-15T10:10:48.551Z', '0.0.13': '2015-12-04T17:16:43.662Z', '0.0.14': '2015-12-05T01:40:39.377Z', '0.0.15': '2015-12-05T05:50:59.226Z', '0.0.16': '2015-12-10T12:23:28.722Z', '0.0.17': '2015-12-14T19:37:08.400Z', '0.0.18': '2015-12-15T12:51:47.990Z', '0.0.19': '2015-12-15T18:23:33.077Z', '0.0.20': '2015-12-15T20:39:55.357Z', '0.0.22': '2016-02-20T00:36:56.908Z', '0.0.23': '2016-02-20T01:44:13.897Z', '0.0.24': '2016-02-25T17:41:20.619Z', '0.0.25': '2016-03-10T02:10:05.410Z', '0.0.26': '2016-03-23T00:39:46.402Z', '0.0.27': '2016-03-23T22:05:56.538Z', '0.0.28': '2016-03-28T22:39:45.766Z', '0.0.29': '2016-03-30T18:10:47.060Z', '0.0.30': '2016-04-06T22:27:32.015Z', '0.0.31': '2016-04-11T18:20:32.677Z', '0.0.33': '2016-04-19T22:31:48.209Z', '0.0.34': '2016-04-26T17:56:20.524Z', '0.0.37': '2016-05-03T18:49:21.731Z', '0.0.39': '2016-05-04T16:29:23.054Z' }, maintainers: [ 'angularcore [email protected]', 'rodyhaddad [email protected]' ], description: 'CLI tool for Angular', versions: [ '0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.0.10', '0.0.11', '0.0.12', '0.0.13', '0.0.14', '0.0.15', '0.0.16', '0.0.17', '0.0.18', '0.0.19', '0.0.20', '0.0.22', '0.0.23', '0.0.24', '0.0.25', '0.0.26', '0.0.27', '0.0.28', '0.0.29', '0.0.30', '0.0.31', '0.0.33', '0.0.34', '0.0.37', '0.0.39' ], 'dist-tags': { latest: '0.0.39' }, readmeFilename: 'README.md', homepage: 'https://github.com/angular/angular-cli', keywords: [], repository: { type: 'git', url: 'git+https://github.com/angular/angular-cli.git' }, author: 'Angular Authors', bugs: { url: 'https://github.com/angular/angular-cli/issues' }, license: 'MIT', contributors: [ 'Rody Haddad [email protected] (http://rodyhaddad.com/)', 'Igor Minar [email protected]' ], users: { altrim: true, seachange: true }, version: '0.0.39', main: 'lib/cli/index.js', trackingCode: 'UA-8594346-19', bin: { ng: './bin/ng' }, scripts: { test: 'node tests/runner', lint: 'eslint .' }, engines: { node: '>= 4.1.0' }, dependencies: { broccoli: '^1.0.0-beta.7', 'broccoli-caching-writer': '^2.2.1', 'broccoli-concat': '^2.2.0', 'broccoli-funnel': '^1.0.1', 'broccoli-merge-trees': '^1.1.1', 'broccoli-source': '^1.1.0', 'broccoli-writer': '^0.1.1', chalk: '^1.1.3', 'ember-cli': '2.5.0', 'ember-cli-string-utils': '^1.0.0', exit: '^0.1.2', 'fs-extra': '^0.30.0', glob: '^7.0.3', leek: '0.0.21', lodash: '^4.11.1', opn: '4.0.1', resolve: '^1.1.7', shelljs: '^0.7.0', 'silent-error': '^1.0.0', 'symlink-or-copy': '^1.0.3', 'systemjs-builder': '^0.15.16', typescript: '^1.8.10', typings: '^0.8.1' }, 'ember-addon': { paths: [ './addon/ng2/' ] }, devDependencies: { chai: '^3.5.0', 'clang-format': '^1.0.38', eslint: '^2.8.0', 'exists-sync': '0.0.3', minimatch: '^3.0.0', mocha: '^2.4.5', 'mock-fs': '^3.8.0', 'object-assign': '^4.0.1', rewire: '^2.5.1', sinon: '^1.17.3', through: '^2.3.8', tslint: '^3.8.1', 'walk-sync': '^0.2.6' }, gitHead: '8a15f90ccc6783196069325cd9249326424275b0', dist: { shasum: '89f55716f31a6e517f6404a6fd7f360292c893ed', tarball: 'https://registry.npmjs.org/angular-cli/-/angular-cli-0.0.39.tgz' }, directories: {} }

  3. Repro steps. ng new angular2-cli-test cd angular2-cli-test ng serve

  4. The log given by the failure. Normally this include a stack trace and some more information.

c:\Workspaces\angular2-cli-test>ng serve

Running without elevated rights. Running Ember CLI "as Administrator" increases performance significantly. See ember-cli.com/user-guide/#windows for details.

Livereload server on http://localhost:49154 Serving on http://localhost:4200/ The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with: Error: EPERM: operation not permitted, symlink 'c:\Workspaces\angular2-cli-test\tmp\broccoli_type_script_compiler-cache_path-EyQJV SXC.tmp\src\app\angular2-cli-test.component.spec.js.map' -> 'c:\Workspaces\angular2-cli-test\tmp\broccoli_type_script_compiler-out put_path-C73bxA1u.tmp\src\app\angular2-cli-test.component.spec.js.map'

  1. Mention any other details that might be useful. I'm on Win 7 ... no admin rights ... and I will never get admin rights due to the security restrictions in the company.

miroslavhornak avatar May 05 '16 14:05 miroslavhornak

Full log: c:\Workspaces\angular2-cli-test>ng serve

Running without elevated rights. Running Ember CLI "as Administrator" increases performance significantly. See ember-cli.com/user-guide/#windows for details.

Livereload server on http://localhost:49154 Serving on http://localhost:4200/ The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with: Error: EPERM: operation not permitted, symlink 'c:\Workspaces\angular2-cli-test\tmp\broccoli_type_script_compiler-cache_path-EyQJV SXC.tmp\src\app\angular2-cli-test.component.spec.js.map' -> 'c:\Workspaces\angular2-cli-test\tmp\broccoli_type_script_compiler-out put_path-C73bxA1u.tmp\src\app\angular2-cli-test.component.spec.js.map' at Error (native) at Object.fs.symlinkSync (fs.js:897:18) at BroccoliTypeScriptCompiler._outputFile (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\broccoli-type script.js:206:8) at c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:108:18 at Array.forEach (native) at c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:107:30 at Array.forEach (native) at BroccoliTypeScriptCompiler._doIncrementalBuild (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\brocc oli-typescript.js:93:19) at BroccoliTypeScriptCompiler.build (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\broccoli-typescript .js:43:10) at c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\broccoli-caching-writer\index.js:152:21 at lib$rsvp$$internal$$tryCatch (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\broccoli-caching-writer \node_modules\rsvp\dist\rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\broccoli-caching- writer\node_modules\rsvp\dist\rsvp.js:1048:17) at lib$rsvp$$internal$$publish (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\broccoli-caching-writer
node_modules\rsvp\dist\rsvp.js:1019:11) at lib$rsvp$asap$$flush (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\broccoli-caching-writer\node_mo dules\rsvp\dist\rsvp.js:1198:9) at nextTickCallbackWith0Args (node.js:420:9) at process._tickCallback (node.js:349:13)

The broccoli plugin was instantiated at: at BroccoliTypeScriptCompiler.Plugin (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\broccoli-caching-w riter\node_modules\broccoli-plugin\index.js:10:31) at BroccoliTypeScriptCompiler.CachingWriter [as constructor](c:Workspacesangular2-cli-testnode_modulesangular-clinode_mo dulesbroccoli-caching-writerindex.js:21:10) at BroccoliTypeScriptCompiler (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\broccoli-typescript.js:27 :10) at Angular2App._getTsTree (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\angular2-app.js:280:18) at Angular2App.buildTree (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\angular2-app.js:101:23) at new Angular2App (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\lib\broccoli\angular2-app.js:42:23) at module.exports (c:\Workspaces\angular2-cli-test\angular-cli-build.js:6:10) at Class.module.exports.Task.extend.setupBroccoliBuilder (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_module s\angular-cli\lib\models\builder.js:55:19) at Class.module.exports.Task.extend.init (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\li b\models\builder.js:89:10) at new Class (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\node_modules\core-object\core- object.js:18:12) at Class.module.exports.Task.extend.run (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\lib \tasks\serve.js:15:19) at c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\lib\commands\serve.js:64:24 at lib$rsvp$$internal$$tryCatch (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\node_module s\rsvp\dist\rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\node modules\rsvp\dist\rsvp.js:1048:17) at lib$rsvp$$internal$$publish (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\node_modules \rsvp\dist\rsvp.js:1019:11) at lib$rsvp$asap$$flush (c:\Workspaces\angular2-cli-test\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\d ist\rsvp.js:1198:9)

miroslavhornak avatar May 05 '16 15:05 miroslavhornak

:+1: I am also getting the same error on the same version. Need help on this.

reflexdemon avatar May 06 '16 11:05 reflexdemon

You guys need to run ng serve inside a cmd with administrator privileges. or whatever comandline you use, but with admin rights.

monojack avatar May 06 '16 12:05 monojack

+1 same problem, Windows 10 x64 no admin rights npm -v 3.8.1 node -v v5.7.0 ng -v angular-cli: 0.0.39

This should be doable without admin rights...

alexciesielski avatar May 06 '16 13:05 alexciesielski

no admin rights ... and I will never get admin rights due to the security restrictions/policy in the company.

miroslavhornak avatar May 06 '16 15:05 miroslavhornak

+1 same here on Windows 10. Running console as an administrator "solves" the problem but this is not a real solution.

hawlik avatar May 06 '16 18:05 hawlik

Actually, this is the solution. Unfortunately, Windows does not allow to create symbolic links outside of administrator. Broccoli, which we're using to build the app, uses symlinks to save time when copying large amount of files.

There's nothing we can do for now, but we know about the issue and we're looking at potential solutions.

Closing this but feel free to continue the discussion.

hansl avatar May 06 '16 20:05 hansl

+1 Sadly this makes it impossible to use at work for a lot of people.

patrickstubner avatar May 07 '16 08:05 patrickstubner

this is very sad.. admin rights are not possible in corporate environments. maybe this whole thing is made for startups where they have all sorts of rights :)

realsaraf avatar May 10 '16 21:05 realsaraf

See http://ember-cli.com/user-guide/#symlinks-on-windows for instructions on allowing symlinks on Windows for non-administrators. In corporate environments this can easily be set using Group Policy for developers.

The warning Running without elevated rights. Running Ember CLI "as Administrator" increases performance significantly. will still be displayed, however performance is no longer impacted and the error will not be encountered.

This may be worth mentioning in the README, as it is a better solution that unnecessarily running with admins rights.

ph1ll avatar May 11 '16 10:05 ph1ll

Would it be possible for BroccoliTypeScriptCompiler to check if it is running under Windows without Admin rights and display a related message? Otherwise it can be confusing to try and debug the code file it points to.

ghost avatar May 13 '16 17:05 ghost

We solved this issue for us using this little patch of file angular-cli/lib/broccoli/broccoli-typescript.js in line 206:

try {
  fs.symlinkSync(absoluteFilePath, outputFilePath);
} catch(e) {
  const conentStr = fs.readFileSync(absoluteFilePath);
  fs.writeFileSync(outputFilePath, conentStr);
}

It runs little slower than creating symlink, but still it's totally fine for us. Probably one can also use a more performing way for synchronous copying files using node (?).

ludwighunecke avatar May 18 '16 07:05 ludwighunecke

@ludwighunecke I tried doing what you suggested, but now I'm getting an error that broccolitypescriptcompiler can't find browser.d.ts

alexkibler avatar May 19 '16 18:05 alexkibler

@alexkibler I just did what @ludwighunecke suggested and it works.. I did it at the project level..

jshaw-cm avatar May 19 '16 21:05 jshaw-cm

@shawmjustin I'm all good now too. turns out our corporate firewall blocked the typings install, so after I made a .typingsrc to allow insecure connections, I was installing with my globally installed version of typings, which is different from the one in cli.

I ran the installed typings install and now I'm all good.

alexkibler avatar May 20 '16 12:05 alexkibler

Azure doesn't allow the creation of symbolic links. Anyone have any luck getting "ng server" to work on Azure? I've modified the broccoli-typescript.js file to no avail. non of the "ng" commands seem to work in Azure because of the "EPERM" error.

zorthgo avatar May 22 '16 16:05 zorthgo

There has to be a better solution. Requiring admin right is something that is going to make angular-cli unusable and impractical in our environment.

jasonholmberg avatar May 31 '16 15:05 jasonholmberg

@slowtrailrunner use solution by @ludwighunecke. It works whether you have admin rights or not.

jshaw-cm avatar May 31 '16 15:05 jshaw-cm

@slowtrailrunner I created a pull request to correct the issue but is still pending... https://github.com/angular/angular-cli/pull/905

degiorgig avatar May 31 '16 15:05 degiorgig

@shawmjustin thanks. That definitely works.

@leader80 does your PR address the performance, or is that just a Windowz problem?

jasonholmberg avatar May 31 '16 20:05 jasonholmberg