I'm using the webapp generator and I'm getting errors on a default build.
I create a new directory and run
yo webapp
Then
grunt
And finally
grunt server:dist
The Chrome console gives me the following errors:
Allo 'Allo! a53234b6.main.js:3
Running jQuery 1.10.2 a53234b6.main.js:3
Failed to load resource http://127.0.0.1:35729/livereload.js?snipver=1
Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:9000/modules/a53234b6.main.js
Uncaught Error: Script error for: a53234b6.main
http://requirejs.org/docs/errors.html#scripterror skitch.js:354
Am I using the wrong commands? Do I need to update node, npm, yeoman, etc? This is an awesome tool, but I might need to switch back to manual mode b/c I can't troubleshoot it very well
In your package.json, under devDependencies, add the following:
"devDependencies": {
...
"grunt": "~0.4.2",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.3.0",
...
"grunt-contrib-watch": "~0.5.2",
...
"grunt-contrib-livereload": "0.1.2", // <- add this line
Then:
$> npm install
$> bower install
$> grunt server
Related
I'm not very used to working with node and I'm having a nightmare installing the packages for a project.
I'm using vagrant/VirtualBox Homestead on Windows 10 for a Laravel (5.2) project. When doing npm install I've had a whole bunch errors - I can't remember them all specifically, but I'm wondering if there is some big picture issue I'm missing.
My first attempt was with a recent node node version - 12.something I think.
Then I was told that "some of those older projects used v8, I think", so I used nvm to do that and got a whole bunch of different issues. Some involved sym links, so I deleted node_modules and tried with --no-bin-links. That didn't work, and one of the errors, when I looked on SO, was down to node version, so I tried v9.0.0, which gave different problems.
How hard can it be?
I don't know enough about this frontend stuff to know if it's normal to have so much trouble, or if I have not been given sufficient information - e.g. "you absolutely need to use node version 8.1.3, with these specific other details..." or something like that.
Does anyone have any suggestions on how to get this working? The node-sass package seems to be a significant culprit in the overall failage of the installation...
Below is my package.json
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch"
},
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"bootstrap-sass": "^3.0.0"
},
"dependencies": {
"node-sass": "^4.1.0"
}
}
I was heading same problem last time. Here is what I did:
Using terminal in homestead directory run command vagrant plugin install vagrant-winnfsd it will install plugin that allows you to use NFS protocol on Windows.
Edit you Homestead.yaml file like that:
folders:
- map: ~/Projects
to: /home/vagrant/code
type: "nfs"
Run command vagrant reload --provision. After that when you use secure shell - vagrant ssh you should be able to run npm install from inside you project directory.
Based on this question, when I try to run the suggested answer (heroku run npm run "script name") I get "bash: npm: command not found". I'm trying to trigger the script on a deployed meteor NodeJS app to Heroku (node version 4.8.2 and npm version 4.6.1). Any solutions to why?
package.json
{
"name": "admini_meteor",
"private": true,
"scripts": {
"deploy": "MONGO_URL=mongodb://52.1.130.211/cloud meteor"
},
"dependencies": {
"babel-runtime": "^6.23.0",
"bcrypt": "^1.0.2"
}
}
Procfile
web: npm run deploy
You need to add nodejs in your buildpack
And then deploy your app again! That's all!
I am no expert but I will try to give you a hint of your problem because I had the same one. Everything is in the docs you just need to read it.
So far the web process in the one taking care of running the actual app/server like here.
But also how is your project structure? Heroku detects you are developing a node project (because of package.json file in root directory) so it should install npm for you.
In my case I was developing a Laravel app, therefore, it created a PHP application without node and npm. There is a way to tell heroku you need both environments like state here
We are trying to Install node in our asp.net MVC project how ever when we checked our code in it would fail the builds in team city. this is due the well known issue of the long module path names that NPM uses.
here is the log:
[08:07:46]Checking for changes
[08:07:49]Publishing internal artifacts (5s)
[08:07:54][Publishing internal artifacts] Sending build.start.properties.gz file
[08:07:49]Clearing temporary directory: C:\TeamCity\buildagent3\temp\buildTmp
[08:07:54]Clean build enabled: removing old files from C:\TeamCity\buildagent3\work\57c6a27fa330ee2f
[08:07:54]Checkout directory: C:\TeamCity\buildagent3\work\57c6a27fa330ee2f
[08:07:54]Updating sources: agent side checkout (15s)
[08:07:54][Updating sources] Will perform clean checkout. Reason: Checkout directory is empty or doesn't exist
[08:07:54][Updating sources] Cleaning C:\TeamCity\buildagent3\work\57c6a27fa330ee2f
[08:07:54][Updating sources] VCS Root: git - tempsearch (15s)
[08:07:54][VCS Root: git - tempsearch] revision: cf23c64dd32077edeb1b96a85d1be104bd127044
[08:07:54][VCS Root: git - tempsearch] Cleaning C:\TeamCity\buildagent3\work\57c6a27fa330ee2f
[08:07:54][VCS Root: git - tempsearch] The .git directory is missing in 'C:\TeamCity\buildagent3\work\57c6a27fa330ee2f'. Running 'git init'...
[08:08:05][VCS Root: git - tempsearch] Checking out branch refs/heads/develop in git - tempsearch in C:\TeamCity\buildagent3\work\57c6a27fa330ee2f with revision cf23c64dd32077edeb1b96a85d1be104bd127044
[08:08:10]
[Updating sources] Failed to perform checkout on agent: '"C:\Program Files (x86)\Git\bin\git.exe" checkout -q -f develop' command failed.
stderr: fatal: cannot create directory at 'node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion': No such file or directory
[08:08:10]Publishing internal artifacts
[08:08:10][Publishing internal artifacts] Sending build.finish.properties.gz file
[08:08:10]Build failed to start. Artifacts will not be published for this build
[08:08:10]Build finished
the error:
Error while applying patch: Failed to perform checkout on agent: '"C:\Program Files (x86)\Git\bin\git.exe" checkout -q -f develop' command failed.
stderr: fatal: cannot create directory at 'node_modules/grunt-contrib-jasmine/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion': No such file or director
are there any long term solutions to this problem?
To the respond of the comment. I have a bit more space here ;).
It depends a bit on your exact situation how I would solve this. This is how I have set things up at the company here:
Setup for developing
Some node modules have to be installed globally, so each developer would have to install those globally (grunt-cli, karma, bower for example). The other node_modules that can/have to be installed locally you would add to a package.json file like:
"devDependencies": {
"grunt": "~0.4.2",
"grunt-karma": "~0.7.3",
"karma-jasmine": "~0.2.0",
"karma-firefox-launcher": "~0.1",
"karma-chrome-launcher": "~0.1",
"karma-phantomjs-launcher": "~0.1",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-less": "~0.9.0"
}
More information about package.json you can find here http://browsenpm.org/package.json. Note that bower has to be installed globally and locally (if you are using it).
This means that every develop has to do a global install of the node_modules you use once. You might want to choose a specific version of each node_module so that everyone is using the same version. You can install global modules like this:
~ npm install grunt-cli karma bower -g
You add the package.json file with the local modules to the base structure of your project, and you add this to the git repository. Each developer that will do a checkout will receive this file. They will have to do an install of the local modules so that everyone is using the same tools:
~ npm install
This means that the local modules don't have to be part of your git repo, which I find good practice since it isn't source code. But it also solves your problem of git not supporting the long node_modules paths.
If you have a build process with Node setup that doesn't change anymore, the npm_modules installed both globally and locally won't have to change. If you change the tools, each develop will have to redo the npm install. But for me this hasn't happened yet.
Build server
You will also have to install node and these global modules on the build server so that you have access to them during the build. What I have done is create a .bat file which gets executed during the build which includes a 'npm install' so that it will resolve the node_modules during the build as well. This way you also have access to the latest tools during a build.
Multiple projects
If you have multiple projects which use the same local node_modules for the build, you should take a look at grunt-collections. You can create one central location for the node_modules this way, so the developers only have to install them once for all the projects There is a really good post about this here:
Centralise node_modules in project with subproject
Hope this clears things ups
I had this error too but in my case the cause was using an outdated version of npm, v1.4.28.
Updating to npm v3 followed by rm -rf node_modules ; npm -i worked for me. npm issue 2697 has details of the 'maximally flat" folder structure included in npm v3 (released 2015-06-25).
I have a dev dependancy in my package.json file that points to a local gitlab repository.
"devDependencies": {
"browser-sync": "^1.2.1",
"event-stream": "^3.1.5",
...
"mymodule": "git+http://my.gitlab.url/team/repo.git",
...
"run-sequence": "^0.3.6"
}
This does not work. When I look in the npm-debug.log file, it seems that instead of cloning the repo from gitlab, its trying to find it in the npm repository:
26 http GET https://registry.npmjs.org/mymodule
27 http 404 https://registry.npmjs.org/mymodule
Then of course further down in the file:
32 error 404 404 Not Found: mymodule
32 error 404
32 error 404 'mymodule' is not in the npm registry.
32 error 404 You should bug the author to publish it
If i run git clone to get the contents of the repo it works. If I run "npm install" followed by the path in the package.json file it works. But it does not work when I run a simple "npm install".
Can anyone explain why?
So..... why does it not honour the gitlab path in my package.json when I run "npm install"?
The error messages are a red herring. This was caused by app level inspection (and blocking) on our firewall. Answer here as a "something to check with your security guys" for the next person.
In openshift server, we don't have root access that's why we can't install any npm package globally .
My question is how to setup and get working casperjs and phantomjs together in openshift server.
You may want to try a ready-to-use cartridge: https://github.com/daniel-sc/casperjs-cartridge
In package.json, add the modules you want to install on OpenShift for your app inside "dependencies" object:
"dependencies": {
"casperjs": "*",
"phantomjs": "*",
// other modules
}
Don't forget to commit and push the change onto OpenShift