Создайте проект со следующими package.json
файл:
{
"name": "requirejs-library-skeleton",
"description": "RequireJS skeleton for modern JS libraries.",
"version": "0.2.0",
"homepage": "http://github.com/tkellen/requirejs-library-skeleton",
"author": "Tyler Kellen",
"engines": {
"node": ">=0.6.0"
},
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"grunt": "~0.4",
"grunt-contrib-watch": "*",
"grunt-contrib-less": "~0.6.1",
"grunt-contrib-requirejs": "~0.3.2",
"grunt-contrib-jasmine": "~0.4.0",
"grunt-template-jasmine-requirejs": "*",
"grunt-contrib-connect": "~0.1.0",
"grunt-file-creator": "*",
"clean-pattern": "*",
"grunt-concat-css": "*",
"grunt-phpcs": "*",
"grunt-phplint": "*",
"grunt-phpunit": "*",
"grunt-exec": "*"
}
}
Есть следующие Vagrantfile
config:
Vagrant.configure("2") do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provision :shell, :path => "bootstrap/bootstrap.sh"
# ... other stuff like opening ports ...
end
bootstrap.sh
наиболее интересно и выглядит так:
#!/usr/bin/env bash
# Installing prequisites for adding nodejs repository
apt-get update
apt-get install -y python-software-properties python g++ make
# Adding Nodejs specific repository
add-apt-repository -y ppa:chris-lea/node.js
# Installing other software
# ... apt-get invocations ...
# Installing grunt harness
npm install -g grunt-cli
# Other preparation tasks
# ... setting up DB, runtime directories, generating configs, etc.
# Moving to codebase root now
cd /vagrant
# Disguising ourselves as normal user (hack 1)
su vagrant
# Cleaning the NPM cache (hack 2)
npm cache clean
# Installing nodejs prequisites
npm install
# Rebuilding codebase (I have to run it after EVERY change in configuration, CSS and/or JS files).
grunt
# Other post-deploy application-specific things
# ...
echo "All should be done\n";
На npm install
при вызове он терпит неудачу со следующими случайными ошибками:
npm http GET https://registry.npmjs.org/lodash/-/lodash-1.0.1.tgz
npm ERR! Error: ENOENT, lstat '/vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/adm-zip/.travis.yml'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /vagrant
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/adm-zip/.travis.yml
npm ERR! fstream_path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/adm-zip/.travis.yml
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/mkdirp/test/mkdirp.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /vagrant
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/mkdirp/test/mkdirp.js
npm ERR! fstream_path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/mkdirp/test/mkdirp.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! EEXIST, mkdir '/vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/npmconf/test'
File exists: /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/npmconf/test
Move it away, and try again.
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /vagrant
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/npmconf/test
npm ERR! fstream_path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/npmconf/test/builtin.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/kew/test/context.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /vagrant
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/kew/test/context.js
npm ERR! fstream_path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/kew/test/context.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! EEXIST, mkdir '/vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/ncp/test/fixtures/src'
File exists: /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/ncp/test/fixtures/src
Move it away, and try again.
npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /vagrant
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/ncp/test/fixtures/src
npm ERR! fstream_path /vagrant/node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/ncp/test/fixtures/src/d
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
Что, черт возьми, здесь происходит?
Если я сделаю vagrant ssh
и беги cd /vagrant; npm install
там npm работает без проблем!
Хорошо, я нашел здесь решение: https://askubuntu.com/questions/269727/npm-errors-when-installing-packages-on-windows-share
Мне просто нужно использовать npm install --no-bin-links
. Был бы рад получить ответ Зачем.