Nothing happen with bower install - node.js

I'm trying to setup angular app with yeoman, following this steps: http://yeoman.io/
Everything works fine until I do
grunt test
I got
Chrome 24.0.1312 (Linux) ERROR
Uncaught ReferenceError: angular is not defined
at /var/www/moviz-test/app/scripts/app.js:3
Chrome 24.0.1312 (Linux) ERROR
Uncaught ReferenceError: angular is not defined
at /var/www/moviz-test/app/scripts/controllers/main.js:3
It's because bower install do nothing, I don't have the folder app/bower_components
.bowerrc
{
"directory": "app/bower_components"
}
bower.json
{
"name": "myApp",
"version": "0.0.0",
"dependencies": {
"angular": "~1.0.7",
"json3": "~3.2.4",
"jquery": "~1.9.1",
"bootstrap-sass": "~2.3.1",
"es5-shim": "~2.0.8",
"angular-resource": "~1.0.7",
"angular-cookies": "~1.0.7",
"angular-sanitize": "~1.0.7"
},
"devDependencies": {
"angular-mocks": "~1.0.7",
"angular-scenario": "~1.0.7"
}
}
I've uninstall and reinstall bower and nothing change
bower -v 1.2.3
node -v v0.10.17

This happened to me as well. The reason was that I was following old tutorial that said bower's package file was components.json instead of bower.json. So bower was looking for later and as it couldn't find file it would just say nothing (it should actually show warning or error). When I renamed file to bower.json it all worked.

I couldn't install newest ember package because bower install did nothing, but:
cd bower_components
rm -rf package-name
now bower install
helped.

Related

npm not installing packages and not creating package-lock.json

I created a new Laravel project with laravel new x
changed into that folder with cd x
tried installing the npm packages with npm install
This didn't work like expected.
I just got an Error: Cannot destructure property 'name' of '.for' as it is undefined.
Then I was like yeah lets just add a name to the package so I did
Ran npm install again
After that it installed something and prompted: Installed 1 Package
Instead of installing the specified devDependencies, creating a package-lock and a node_modules folder, it installed a package with the name that i just specified, globally. I knew that because of npm ls -g. So now i dont have any packages installed locally in my folder but a dependency globally that does nothing.
Output of npm ls and npm ls -g:
C:\Users\johnw\AppData\Roaming\npm
└── theNameIJustSpecified#
My package.json looks like this (and was auto-generated by the laravel installer):
{
"name": "myName",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.2",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"vite": "^4.0.0"
}
}
npm -v: 9.2.0
node -v: v19.3.0
os: windows 11
Normally this just worked out of the box with the Laravel installer. I just typed npm install and it worked.
I tried reinstalling Node and npm, even used Nvm for Windows without any change.
I tried restarting my pc without any change.
I tried creating the package.json via npm init, didn't change anything other than the output of npm ls -g (added 1.0.0 to the end):
C:\Users\johnw\AppData\Roaming\npm
└── theNameIJustSpecified#1.0.0
Edit: Tried downgrading to npm 8, also didn't work.
Downgrading to 7 works again, but I get warning because of too old version.
I checked other projects (old Laravel projects) and they have the same problem now. I used to work in them for months using npm packages for asset bundling. Now they give me the same error.

Post install is replacing npm install folder in linux

I am doing npm install ,after that it is creating node modules folder .
then there is post install option is there which is working fine in windows but in Linux box it is deleting node modules and creating again .
package.json format:
{
"someDependency":{
"#fortawesome/ember-fontawesome": "0.1.9",
"#fortawesome/free-regular-svg-icons": "5.1.0",
},
"scripts":{
"postInstall": "npm install --abc download"
}
}
can anyone help me with how to resolve the issue.

Webpack not working in my node.js project. fsevents

I'm currently trying to implement this tutorial:
https://www.typescriptlang.org/docs/handbook/react-&-webpack.html
I'm supposed to install react and react-dom and also webpack + typescript + awesome-typescript-loader + source-map-loader, and that's what I did. I also installed webpack-cli accordingly to instructions that I got from the command line.
I installed all of them locally (the react and react-dom as PROD and the rest as DEV dependencies).Currently I don't have any packages installed globally.
After this, that's my package.json file:
{
"name": "reactandwebpack-tutorial",
"version": "1.0.0",
"description": "",
"main": "webpack.config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"awesome-typescript-loader": "^5.2.0",
"source-map-loader": "^0.2.3",
"typescript": "^2.7.2",
"webpack": "^4.16.4",
"webpack-cli": "^3.1.0"
},
"dependencies": {
"#types/react": "^16.4.7",
"#types/react-dom": "^16.0.6",
"react": "^16.4.2",
"react-dom": "^16.4.2"
}
}
At this point, when I run npm ls I get a bunch of errors, because of some optional dependency of webpack that apparently is missing (all the errors in the tree are inside webpack and below fsevents as following):
webpack#4.16.4
(...)watchpack#1.6.0
(...)chokidar#2.0.4
(...)fsevents#1.2.4 -> UNMET OPTIONAL DEPENDENCY
And everything below fsevents is also marked with UNMET DEPENDENCY
And when I run webpack command, I get a "webpack not recognized error".
Anyone can help? I've been trying to wrap my head around this for a while.
PS:
Npm -v 5.6.0
Node -v 8.11.3 //(that's what I get from the terminal,
//VSCode "About" tells me something different, I don't know why).
Using Visual Code
Version 1.24.0
Date 2018-06-06T17:35:40.560Z
Shell 1.7.12
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
The reason is because it was not linked to your env. When you install something globally, you have access to it everywhere, hence it works just by doing webpack. Since you installed everything locally, the binaries are located inside node_modules/.bin.
You have two options when you install something locallly.
Use npm scripts (npm run build, watch... whatever).
./node_modules/.bin/moduleName --flags
It is easier to create a npm script and add all the commands there.
SOLVED
Not sure the reason but it had something to do with the ./bin folder with the webpack-cli "ambient variable" not being available (I don't know it that would be the most accurate description).
When I try to run webpack, I get "not recognized error".
But when I run nodemodules\.bin\webpack-cli it works normally.
Everything is installed locally.
I can also run it with options, like nodemodules\.bin\webpack-cli --help
If you run "webpack", The CLI will find global webpack with is installed by (npm install webpack -g). To use webpack from local project. you should it to npm script.
package.json
{
"script": {
"start": "webpack"
}
}
By doing this, you can run npm start to run webpack.

Node js - cant install packages on a server

I want to have grunt on my server, and via hook, i want the server to run a grunt task that will "build" my site.
I installed node on my server, and i installed grunt-cli using this:
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo npm install -g grunt-cli
then, i go to my project folder, which is where my package.json and gruntfile.js files are located.
im using npm install and then, i see /node_modules folder but i don't see the packages there.
I don't see any error. Do you know why this happens? perhaps server configuration?
package.json
{
"name": "proj",
"version": "0.1.0",
"private": true,
"devDependencies": {
"angular": "latest",
"angular-animate": "latest",
"angular-ui-router": "latest",
"font-awesome": "^4.5.0",
"grunt": "latest",
"grunt-contrib-clean": "latest"
}
}
With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.
source: https://docs.npmjs.com/cli/install#description
Since you're on a server, I assume, this is a production one and NODE_ENV is set to production. To install both dependencies & devDependencies, run:
NODE_ENV=dev npm install

appfog is unable to install node.js application

I can't get my node.js application to work on appfog. I create a new application on their website. Then in my application directory i run:
af login <-- Works
and then:
af update myapplicationname
I get this error: No such file or directory - /Users/Name/myapplicationname/node_modules/bower
I don't use bower. I tryed use bower but i removed it and the files.
My package.json looks like this:
{
"name": "myapplicationname",
"description": "My application",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x"
}
}
I user version 0.8.14 of node which should be supported by appfog.
What am i missing here?
I run into the following and managed to fix it by:
1) removing the node_modules folder (rm -rf node_modules)
2) reinstall all the dependencies (npm install)
3) recreate the shrinkwrap.json (npm shrinkwrap)

Resources