2

I want to run a project witch written by Angular 1.5 , and I know it was lunch by gulp . and first I use npm install to install all dependencies , and then use gulp to run it. but failed. It gave me 800 problems. most of them looks like :

 226:7   error You should not set properties on $scope in controllers. Use controllerAs syntax and add data to "this"  angular/controller-as
 292:26  error  "$" is not defined   
 334:19  warning  You should use angular.element instead of the jQuery $ object 
 18:11   error    You should not set properties on $scope in controllers. Use controllerAs syntax and add data to "this"  angular/controller-as

But the code is running well in others computer. so I guess it is no the code's problem . I must missed something. Just want to run it . please help me , any info will be helpful.

and there one more thing I have founded , when I use npm install to install dependencies , it gave me some error, so it doesn't install all dependencies . the error is like:

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir     '/Users/jzhu321/Desktop/PwC/Projects/TeamTrack_Project/TeamTrack_Angular/node_modules/utf-8-validate/build'
gyp ERR! System Darwin 18.5.0
gyp ERR! command "/usr/local/bin/node"     "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"     "rebuild"
gyp ERR! cwd /Users/xxxx/Desktop/xx/Projects/xxxx_Project/xxxx_Angular/node_modules/utf-8-validate
gyp ERR! node -v v10.15.2
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

and I have tired some way to fix it (chomd 777 directName..) but. not work.

serraosays
  • 5,487
  • 1
  • 28
  • 49
Neko
  • 441
  • 5
  • 21

1 Answers1

2

Short answer: turn back time with nvm.

This looks a lot like a node.js version issue. You're running v10.x of Node and I'd bet this app was built back in v0.x days, before Node switch over to their great release schedule.

Node-gyp in particular gets problematic this far out. It compiles modules, so it's basically trying to compile stuff that isn't designed for.

Try to figure out when your JS was written and match the Node version to that time period. You can run multiple versions of Node.js with nvm. It can be a pain, but it's what you need - helps your JS time travel back to whenever this app was built.

Go into your terminal before running npm install on your app and set the proper old version of Node.js that will run your app with something like nvm use 4 or whatever version it is you will need.

Then you're going to have a long, painful process of updating modules and watching things break until you can modernize the app.

serraosays
  • 5,487
  • 1
  • 28
  • 49