I am building a AngularJS file with typescript and installed tsd for typedefinitions globally. When I try to run the following command on the root of my project folder I am getting an error
I am new Angular JS using version 1.7. I am not sure if Package.json is needed for AngularJS project
Command
tsd install angular --resolve --save
Error
No package.json file found. Make sure you are running the command in a Node.js project.
package.json is required for node projects to specify metadata about project and include some important commands that may be required for the project build. First you have to install node from official website. You can google for the step by step installation. Once installed, goto your project directory and run this command. Make sure to perform "npm init" before you run the desired angular command.
Note: Ensure, node is accessible through cli
tsd is deprecated use #types node modules
npm i #types/angular --save
I am trying to run the command npx create-react-app under a corporate registry. The problem is that the element sockjs#0.3.18 is not available and therefore it stalls the installation; however, the element sockjs#0.3.17 is. Is there any way I can run that command by specifying it should install a different version of sockjs?.
Using npm ls sockjs, I see this is a dependency of react-scripts#1.1.4 / webpack-dev-server#2.9.4
└─┬ react-scripts#1.1.4
----└─┬ webpack-dev-server#2.9.4
--------└── sockjs#0.3.18
There's an option in create-react-app to use a nonstandard version of react-scripts:
--scripts-version <alternative-package>
This should work:
npx create-react-app --scripts-version 0.9.5 app
0.9.5 is the latest version that depends on an earlier sockjs.
I found this by looking up the package.json of webpack-dev-server and then react-scripts that had appropriately downgraded versions. (I did it manually on GitHub release pages... anyone know a better tool for that?)
Alternative approaches:
Get the updated sockjs approved in your corporate registry :)
Assuming the difference between sockjs#0.3.18 and sockjs#0.3.17 is immaterial as for as create-react-app goes (no guarantees), you could probably npm install create-react-app, find the bit in the source code (node_modules/create-react-app/create-react-app.js) that downloads react-scripts, and hack it to point to your own fork of the latest react-scripts with a changed version number for webpack-dev-server (1.16.4). Not recommended!
I have forked the angular 2 github repo, clone it in my desktop, add upstream then run npm install, but when I want to build ($(npm bin)/gulp build) i have an error message:
"Task 'build' is not in your gulpfile"
How can I properly build the project?
Try gulp build.sh for more recent versions. You can also run simply ./build.sh from the base directory. For future reference you can see a list of gulp tasks using gulp -T.
Make sure you're using the correct version of node (use nvm if you need to) as described in the developer guide.
I have been following the repo A healthy Gulp Setup for the gulp setup of my AngularJS project.
I can successfully proceed with this in an older version of nodejs. But on my another system, I have installed a newer version "NodeJS 4.2.2" and I get many dependency errors.
At initial try of npm install I got the error
npm WARN engine karma#0.10.10: wanted: {"node":"~0.8 || ~0.10"} (current: {"node
":"4.2.2","npm":"2.14.7"})
I tried modifying the karma version in package.json from 0.10 to 0.13. This time the npm install hangs for hours while processing bufferutil.
C:\wamp\www\ros_ui\node_modules\karma\node_modules\socket.io\node_modules\socket
.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\nodejs\node_mo
dules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
bufferutil.cc
win_delay_load_hook.c
Creating library C:\wamp\www\ros_ui\node_modules\karma\node_modules\socket
.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\
ws\node_modules\bufferutil\build\Release\bufferutil.lib and object C:\wamp\ww
w\ros_ui\node_modules\karma\node_modules\socket.io\node_modules\socket.io-cli
ent\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil\bui
ld\Release\bufferutil.exp
Generating code
Finished generating code
bufferutil.vcxproj -> C:\wamp\www\ros_ui\node_modules\karma\node_modules\sock
et.io\node_modules\socket.io-client\node_modules\engine.io-client\node_module
s\ws\node_modules\bufferutil\build\Release\\bufferutil.node
Is there any work around for this? I would prefer going with latest node version.
Any help would be appreciated. Thanks in Advance.
Try angularcoffee-boilerplate, this is a project template for AngularJS where npm and Gulp are preconfigured. Just clone the project, install prerequisites with the script install_prerequisites.bat and start the server with the command npm start
I am starting out angular app with angular-fullstack in my Windows 7 box. I installed bunch of npm packages with -g options, including grunt-bower-install. I created the application first by running
yo angular-fullstack appname
There were no exception during the application creation. After application was created successfully I tried to run the app using
grunt serve
expecting the server to run. But the 'grunt serve' failed with
Running "bower-install:app" (bower-install) task
Cannot find where you keep your Bower packages.
We tried looking for a .bowerrc file, but couldn't find a custom
directory property defined. We then tried bower_components, but
it looks like that doesn't exist either. As a last resort, we tried
the pre-1.0 components directory, but that also couldn't be found.
Unfortunately, we can't proceed without knowing where the Bower
packages you have installed are.
Fatal error: No Bower components found.
I did find .bowerrc file and it was pointing to app/bower_components. Unfortunately, bower_components file was no where to be found. I am not sure what should be the content of the file to create it myself. Is it the missing file causing this problem or is there a npm package, I did not install correctly?
I installed bower using npm as well *
Thanks
Confusingly, the grunt-bower-install task that comes with angular-fullstack doesn't install bower components. It doesn't install anything. This error is trying to let you know that it can't find the bower_components directly, so it can't do its thing.
To fix the issue, run bower install.
If you don't have Bower installed, run npm install -g bower first.
I had the same issue, here's what worked in my case:
installed ruby and compass (yeoman needs these)
verified that path to Ruby bin folder is added to %PATH%
installed Git
restarted cmd window and ran "bower install" in the app folder
After that, grunt serve command worked perfectly.
Note: maybe installing Git and running bower install would suffice in your case.
I faced the same problem but only did npm install -g bower and then bower install and got grunt serve working.
I did not need to do any of the things mentioned by Olga.
Hope this helps.
npm install -g bower doesn't install bower components, you should run as well bower install to have all bower's components installed and then run grunt serve. It should work fine
Try to do bower install. If its failing saying not able to connect to git then you can change repo pointing location by simply running below command
$ git config --global url.https://github.com/.insteadOf git://github.com/
This will ensure that you will be downloaded over https instead of git if its causing orginasation firewall to block it.
In my case, I added sudo for it to work. So, I ran sudo npm install -g bowerand then bower install. grunt serve then worked when I ran it.
The Bower installation requires the packages to be brought from the Git repository, so first you need to install the Git application in your system. You can download it from this link :https://git-scm.com/downloads . Now after your have downloaded it , there may be a chance that the PATH may not be set up, so go to ControlPanel -> System and Security -> System -> Advance System Settings (on the left-hand side), click it, then goto Environment Variables -> System Variables -> PATH , click edit , and write down the following paths :
;C:\Users\admin\AppData\Local\Programs\Git\bin;
C:\Users\admin\AppData\Local\Programs\Git\cmd ....Well the above path is where Git was installed in my system, you can crawl to the place in your system where Git was installed and select the paths from the "bin" and "cmd" folder and paste it on the PATH variable.
Now, after the GIT path is setup, you can now type in the command " $ bower install " , this will install all of your bower packages.
npm install -g bower
bower install
grunt serve
worked for me ...
npm install -g bower
bower install
grunt serve
It's worked too