6
votes

My project includes some python codes and build with grunt.I write .travis.yml like:

language: node_js
before_install:
  - pip install Django
  - npm install -g grunt-cli
  - npm uninstall grunt # https://github.com/npm/npm/issues/3958
node_js:
  - "0.10" 
python:
  - "2.7"

But that failed: *

OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/Django-1.7.1.dist-info'

*

It seems like I cannot 'pip install' in a 'node_js' project.

2

2 Answers

5
votes

Instead of using sudo, pass the --user flag into pip (e.g., pip install --user django) to install the package in the home directory. This approach also works in Travis’ container-based infrastructure, which disallows sudo.

0
votes

It's kind of solved.A sudo must be prepend to 'pip install'.

I guess 'npm install -g grunt-cli' does not need sudo because it's a 'node_js' project.Right?