I was stuck when I install truffle to my Mac PC.
I tried to install it with npm install -g truffle and it worked after I made a folder for global install.
However, when I try to run Truffle
truffle init
it returns -bash: truffle: command not found
I also reinstall it and run it again but nothing was changed.
How can I deal with this issue ?
It would be really appreciated if you explained in detail.
I think on windows you are suppose to use truffle.cmd instead of truffle.
So try,
truffle.cmd init
Keeping in mind that truffle init is depreciated so you should try using
truffle.cmd unbox metacoin
You can reinstall it by this commands
npm uninstall -g truffle
Install it by
npm install -f truffle
Thanks
Related
ts-node appears to be installed, the package is visible users/user/node_modules/ts-node, but when entering ts-node in the command line or trying to run a command I receive the error "zsh: command not found: ts-node".
installed via 'sudo npm install -g ts-node' ; have scoured the first 3-4 pages of google search but no solutions worked.
On a macbook, not sure what needs to be moved/how to move it around so that the system recognizes it's installed. Help would be greatly appreciated.
Maybe u can use npx ts-node to solve this.
You can try $ npm init -y on project folder, after run $ npm install -g ts-node.
I am having a problem running Sanity's CLI. I have installed the CLI with npm install -g #sanity/cli which works without a problem, and everything is installed correctly (as far as I can tell).
However, trying to use any of their CLI instructions, such as sanity init, I get this error message:
zsh: command not found: sanity
I am using npm version 6.14.11 and node version v14.16.0.
I've also been noticing a few random commands return the same zsh: command not found for various packages.
with npx it works
npx #sanity/cli init
#user1934428 is right.
I just change in the command "sanity ..." to "usr/local/Cellar/node/16.3.0/lib/node_modules/#sanity/cli/bin/sanity ..." and it worked
I had a similar problem on my mac which was caused by not installing sanity globally.
Go to your terminal and enter:
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
Enter your password then install sanity globally
npm install -g ng
This should solve the issue and sanity commands should work too.
I'm trying to set up the tools needed to develop a decentralised application.
I would need to input truffle init to my terminal as part of the process. I've tried multiple times to solve the "command not found" message I keep getting when I input truffle init, but I have not found a solution. I'm not sure if there are any other ways I could bypass this issue. It seems as though a lot of the developer tools I've tried to install for blockchain development have been difficult to install or integrate with my Mac.
Thank you for any assistance provided.
Have you tried to install truffle globally?
sudo npm install -g truffle#latest
Please verify that you have installed truffle properly using
truffle -version
I installed the composer-cli globally but it shows me error
"-bash: composer: command not found" at mac os sierra
Please make sure you did not install using sudo and that you check that the install actually worked. e.g. it will fail if you don't have XCode installed.
Yes to add to the point mentioned above.After installing Xcode it didnt work out for me . So i changed my node version from
11
to
8.8.15
and did npm install -g composer-cli. It worked for me .
just installed new ubuntu vm to test around with node
installed things in this order:
node
mongodb-server
npm
express
mongoose
now, trying to create a new app i noticed express cannot be used in the shell.
express -v returns
express: command not found
i installed npm like this
curl http://npmjs.org/install.sh | sudo sh
and i installed express this way
npm install express
any ideas?
Starting from express 4.00 you also need to install express generator with:
npm install -g express-generator
Only after this will you be able to run express as a command!
For confirmation see: ExpressJS.com - Migrating to Express 4
npm install express -g
You need to install it globally.
Npm 1.0 installs modules locally by default. So the bash executable lives in /node_modules/bin/. You can add that folder to PATH or you can just install express globally so that it's picked up by PATH
I had this problem and was installing node via Homebrew. The problem was being caused by Homebrew.
So I did:
brew uninstall node
and then installed node using the installer on the nodejs.org site.
Then I ran:
npm install -g express
And voila no problems.
With the release of Express 4.0.0 it looks like you need to do sudo npm install -g express-generator.
EDIT 2017-06-29: this answer is 6+ years old, but still gets votes/traffic. Instead (for any new users with problems) I'd trust both NODE_PATH official doc and its corresponding bit about REPL usage before this answer.
Quite similar to this issue, node was not finding my global express install, so a require('express') statement would fail.
What fixed this for me, when a global install wasn't being picked up by node was making sure NODE_PATH env. variable was is set correctly.
On Ubuntu 11.04, with node version 0.5.0-pre, the paths me were:
NODE_PATH=/usr/local/lib/node_modules:/usr/local/lib/node
So, to clarify you might want to export the above env. variable, or you can just test the above values out by doing:
NODE_PATH=/usr/local/lib/node_modules:/usr/local/lib/node node ./you_app.js
I had to do a combination of things:
From node.js modules path:
echo 'export NODE_PATH="'$(npm root -g)'"' >> ~/.bash_profile && . ~/.bash_profile
This sets the file path in bash profile (can be viewed using nano .bash_profile
Slightly modified from Raynos (above) since I needed sudo:
sudo npm install express -g
Slightly modified from Fazi (above) since I needed sudo:
sudo npm install -g express-generator
TEST YOUR APPLICATION:
run `DEBUG=myapp:* npm start`
Ref: http://expressjs.com/en/starter/generator.html
IF you are running windows:
export NODE_PATH="C:\Users\IMarek\AppData\Roaming\npm\node_modules"