npm install fails after update for windows 10 - ember.js

I, after update my windows, to windows 10, I cannot run npm commands.
I am trying to install ember-cli but I got many errors.
F:\DEV\Ember\Ember1>npm install -g ember-cli
SyntaxError: Error parsing C:\Users\vitorpfn\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\extend\package.json: Unexpected token p
at Object.parse (native)
at readPackage (module.js:81:52)
at tryPackage (module.js:91:13)
at Function.Module._findPath (module.js:153:20)
at Function.Module._resolveFilename (module.js:323:25)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\vitorpfn\AppData\Roaming\npm\node_modules\npm\node_modules\request\index.js:17:29)
at Module._compile (module.js:409:26)
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\vitorpfn\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "ember-cli"
npm ERR! node v4.4.0
npm ERR! npm v3.5.3
npm ERR! path C:\Users\vitorpfn\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\extend\package.json
npm ERR! Error parsing C:\Users\vitorpfn\AppData\Roaming\npm\node_modules\npm\node_modules\request\node_modules\extend\package.json: Unexpected token p
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
I already uninstall node and install again but the problems still the same.
What I am missing?

You can find instructions for installing ember-cli on Windows here or here
Most important steps:
Install Node.js from the official installer
Always open PowerShell or CMD as Administrator.
Install Git for Windows
Open PowerShell as Administrator and run $ Set-ExecutionPolicy Unrestricted -scope Process
Install Ember-CLI-Windows: $ npm install -g ember-cli-windows
Run Ember-CLI-Windows: $ ember-cli-windows
Log out and log back in your Windows
Update npm: $ npm install -g npm
Install ember-cli: $ npm install -g ember-cli
You have to use PowerShell for certain settings, but for long term, probably better if you use Git Shell.

Related

windows 10 -'bash' is not recognized as an internal or external command, operable program or batch file [duplicate]

i have an error in installing react-flux-starter-kit-windows.
i have installed latest node.js and npm
when i am using this command :
npm install -g react-flux-starter-kit
it gives me following error
react-flux-starter-kit#1.1.4 postinstall C:\Users\Hardik\AppData\Roaming\npm\node_modules\react-flux-starter-kit
bash setup.sh
'bash' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Hardik\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "react-flux-starter-kit"
npm ERR! node v6.9.5
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-flux-starter-kit#1.1.4 postinstall: bash setup.sh
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-flux-starter-kit#1.1.4 postinstall script 'bash setup.sh'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the react-flux-starter-kit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bash setup.sh
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs react-flux-starter-kit
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls react-flux-starter-kit
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Hardik\AppData\Roaming\npm-cache_logs\2017-02-22T10_01_48_356Z-debug.log
It seems that it needs Bash installed. If you're using Windows then you may be able to install it using one of:
https://git-for-windows.github.io/
https://www.cygwin.com/
https://msdn.microsoft.com/en-us/commandline/wsl/about
http://win-bash.sourceforge.net/
Go with the steps
Setting->update->for developers->developers mood->on->yes.
Control Panel->programs & features->Turn windows features on or off->Windows subsystem for linux->restart computer.
The same error can appear if the bash isn't present in path env, so you need to add it manually.
Add this directory to your path env:
C:\Program Files\Git\bin
I had the same problem and I solved it in 2 stages:
First, I turned on the 'Developer Mode' (Settings -> Update and Security -> For developers).
Second, I installed Ubuntu app from Microsoft Store, then ran Command Prompt as administrator and typed bash and set a username and password.
To fix this on Windows, if you install git for windows you will get git.exe at this directory:
C:\Program Files\Git\cmd
but the file is git.exe and you need bash.exe for Windows.
So use this to create a doskey alias to bash command
doskey bash=git
Now type bash at command line and you should see the help output from git.exe.
If you're using Windows then you may be able to use GIT Bash which you probably already have it installed or get it from https://gitforwindows.org/ instead of using Windows Command Prompt or Windows PowerShell.

Unable to install nodemon globally through terminal, showing an error

If I give as npm install -g nodemon
getting an error as :
checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
Please any suggestions.
You need root permissions: try with
sudo npm install -g nodemon
This is a permission error and you can use sudo, But Running sudo npm install (without -g) will create a local directory that can only be altered by the root user. This can really screw things up for you if you try to do npm <something> in the same directory or project later on.
Even sudo npm install -g with a valid installation target can mess things up for you and make it hard to use npm without sudo under some circumstances in the future particularly if you change your npm configuration midstream.
you can use the following steps to update your local OS:
Set your prefix for global installs, e.g. npm config set prefix ~/.npm
Update your PATH to include ~/.npm/bin. For example: echo 'export PATH="$HOME/.npm/bin:$PATH"' >> ~/.zshrc if you’re using zsh.
See Don’t Use sudo with npm for more information.

AWS-Amplify-cli fails to install on Mac

Trying to install AWS-Amplify-CLI and followed this
When I run npm install -g #aws-amplify/cli or sudo npm install -g #aws-amplify/cli I get the following errors
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for fsevents#1.2.7 and node#11.8.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/build'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/lib/node_modules/node/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=4" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents
gyp ERR! node -v v11.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/lib/node_modules/node/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/lib/node_modules/node/bin/node" "/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents
node-pre-gyp ERR! node -v v11.8.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/lib/node_modules/node/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/node/lib/node_modules/#aws-amplify/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
npm WARN graphql-import#0.4.5 requires a peer of graphql#^0.11.0 || ^0.12.0 || ^0.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/#aws-amplify/cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 install: node install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
#aws-amplify/cli#0.1.44
added 2 packages from 1 contributor, removed 6 packages and updated 29 packages in 57.461s
When I install node-pre-gyp and node-gyp separately, I get the same errors.
I have CHMOD 0777 on the project folder and then tried to install again without the -g flag, but same error.
OS: Mojave 10.14.2
Node: v11.8.0
npm: 6.5.0
You may also try the following command that worked for me :
sudo npm install -g #aws-amplify/cli --unsafe-perm=true
Fixed.
It seems that there was an issue with my global installation of node and npm, missing/incorrect entries in:
~/.bash_profile
~/.bashrc
The fix was to totally remove node & npm, the re-install using nvm. I followed these:
https://github.com/brock/node-reinstall/
https://gist.github.com/d2s/372b5943bce17b964a79
Please note:
you may need to remove some node or npm files manually
you may need to upgrade node and/or npm afterwards
you may need to reinstall individual node packages afterwards.
I had a similar issue. I needed to set the python version for some odd reason. Something like
npm config set python python2.7 && npm install
Amplify needs local resources and needs to be tied to a environment especially if you are switching between them.
Like dev/prod or local dev on a Mac vs some dev in windows.
Look at amplify env add
I had node installed via brew so my fix was:
uninstall node completely
brew uninstall --force node
install node via: https://nodejs.org/es/ which updates PATH automatically
install amplify:
sudo npm install -g #aws-amplify/cli --unsafe-perm=true
This is what I did to solve this:
Re-install node to the latest version. You can do that using the following steps:
- sudo npm cache clean -f (force) clear you npm cache
- sudo npm install -g n install n (this might take a while)
- sudo n stable upgrade to the current stable version
Note that sudo might prompt your password.
Install amplify:
sudo npm install -g #aws-amplify/cli --unsafe-perm=true
This last process may take a while.
EACCES permissions errors when installing packages globally
First uninstall amplify
npm uninstall -g #aws-amplify/cli
or
sudo amplify uninstall
Reinstall npm with a node version manager, I recommend this guide https://tecadmin.net/install-nvm-macos-with-homebrew/
On command line create a directory for global installations
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
For versions after MacOS Catalina uses nano ~/.zshrc and for versions before this version uses nano ~/.profile and add the next line
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables. If you used ~/. zshrc
source ~/.zshrc
If you used ~/. profile
source ~/.profile
Then try to install amplify
npm install -g #aws-amplify/cli
While the accepted solution seemed to work initially, I encountered further EACCES: permission error while using amplify-cli. The way I got it solved is by resolving EACESS permissions as recommended by npmjs documentation.
Instructions:
On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and add this line:
nano ~/.profile
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
source ~/.profile
Test if the added path is working by looking for the string .npm-global/bin in the outpout:
echo $PATH
Finally, install aws-amplify/cli without using sudo as follows:
npm install -g #aws-amplify/cli

Elastic Beanstalk EBS NPM Bower install is failing

Having an issue with my EBS deployment. Getting this output everytime it tries to deploy the build.
Application deployment failed at 2018-07-02T02:46:14Z with exit status 1 and error: command npm_install_bower in .ebextensions/bower.config failed.
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/bower
npm http GET https://registry.npmjs.org/bower
npm ERR! Error: UNABLE_TO_GET_ISSUER_CERT_LOCALLY
npm ERR! at SecurePair.<anonymous> (tls.js:1430:32)
npm ERR! at SecurePair.emit (events.js:92:17)
npm ERR! at SecurePair.maybeInitFinished (tls.js:1029:10)
npm ERR! at CleartextStream.read [as _read] (tls.js:521:13)
npm ERR! at CleartextStream.Readable.read (_stream_readable.js:341:10)
npm ERR! at EncryptedStream.write [as _write] (tls.js:418:25)
npm ERR! at doWrite (_stream_writable.js:226:10)
npm ERR! at writeOrBuffer (_stream_writable.js:216:5)
npm ERR! at EncryptedStream.Writable.write (_stream_writable.js:183:11)
npm ERR! at write (_stream_readable.js:602:24)
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 4.14.47-56.37.amzn1.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /opt/elasticbeanstalk/eb_infra
npm ERR! node -v v0.10.48
npm ERR! npm -v 1.3.6
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/elasticbeanstalk/eb_infra/npm-debug.log
npm ERR! not ok code 0.
bower.config file is:
commands:
get_sudo:
command: echo Defaults:root \!requiretty >> /etc/sudoers
npm_install:
command: sudo yum -y --enablerepo=epel install nodejs npm
npm_install_bower:
command: sudo npm install -g bower
container_commands:
01_bower_install:
command: "export PATH=$PATH; $NODE_HOME/bin/node ./node_modules/bowe/bin/bower -V install --allow-root -F > /tmp/01_bower_install.log"
Tried it without 01_bower_install part as well but same result. Fails to deploy. Was working fine until 2 days ago on the instance and now showing:
Forbidden You don't have permission to access / on this server.
..on the URL.
Help greatly appreciated!
I spent few hours today on the same issue, bower would not be installed by npm and would not run. Eventually got it work as follows:
1) remove "bower" from package.json
2) here is my ebextension file that managed to install bower and run it, by making it a global command:
container_commands:
install_bower:
command: "export PATH=$PATH:$NODE_HOME/bin; npm install bower -g; bower install --allow-root"
Cheers,
Z.

Can't Install Ember-CLI without sudo

npm install -g ember-cli
npm ERR! Error: Attempt to unlock ember-cli, which hasn't been locked
npm ERR! at unlock (/usr/local/lib/node_modules/npm/lib/utils/locker.js:44:11)
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/cache/add-local.js:30:5)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache/add-local.js:47:20
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/locker.js:30:7
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.2.0-61-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ember-cli"
npm ERR! cwd /home/ahmed
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/ahmed/npm-debug.log
npm ERR! not ok code 0
when installing using sudo, then getting problem in creating new app.
sudo npm install -g ember-cli
/usr/local/bin/ember -> /usr/local/lib/node_modules/ember-cli/bin/ember
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/node_modules/couch-login requires request#'~2.9.202' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request,
npm WARN unmet dependency which is version 2.30.0
ember-cli#0.0.44 /usr/local/lib/node_modules/ember-cli
├── abbrev#1.0.5
├── js-string-escape#1.0.0
├── broccoli-writer#0.1.1 (rsvp#3.0.13, quick-temp#0.1.2)
└── yam#0.0.14 (lodash#2.4.1, findup#0.1.5, fs-extra#0.8.1)
ahmed#shivank-Vostro-2420:~$ ember -v
version: 0.0.44
node: 0.10.31
npm: 1.4.26
First of all remove node completely
$ rm -rf ~/.npm ~/.nvm
Use NVM to manage node version...
$ curl https://raw.githubusercontent.com/creationix/nvm/v0.17.1/install.sh | bash
$ source ~/.nvm/nvm.sh
//add this line to my ~/.bashrc, ~/.profile, or ~/.zshrc
Adding source in profile using nano:
$ nano ~/.profile
Go to bottom of the file and add this line:
source ~/.nvm/nvm.sh
Then hit CTR+X and press Y to save
same for others...
Use stable version of node
$ nvm install 0.10.32
$ nvm use 0.10.32
$ nvm alias default 0.10.32
Once you’ve installed Node, you’ll need to install the Ember CLI globally with:
$ npm install -g ember-cli
This will give you access to the ember command-line runner.
You’ll need to install Bower, a package manager that keeps your front-end dependencies (including JQuery, Ember, and QUnit) up to date. This is as easy as running:
$ npm install -g bower
This will give you access to the bower command-line runner.
Now you can run enberCLI commands.
Cheers.