Comments (12)
@arapehl If you installed it globally, you call it just by running http-server
There are two ways to run the bin from a local install
(Assuming you ran npm install http-server
)
Calling it directly:
./node_modules/.bin/http-server
or using this script I made npm-run script.
First make it executable:
chmod +x npm-run
To run (You can pass any argument also):
./npm-run http-server
I suggest you copy the npm-run script into /usr/local/bin/
so you can use it from any folder where you have node modules that need run locally.
from http-server.
I'm also having this problem.
from http-server.
Node uses modules installed locally. There's no way to include a module installed globally.
from http-server.
The install instructions for http-server are for a global.
from http-server.
Yes - "This will install http-server globally so that it may be run from the command line.". You need to install locally to use it as a module.
from http-server.
But I get the error when I install globally and try using it on the command line. It keeps looking for the bin locally.
from http-server.
How are you running it?
from http-server.
I simply type node http-server
and it says: Error: Cannot find module '/Users/ara/dev/projects/github-link/http-server'
It's looking for it in the dir I'm in instead of looking in /usr/local/lib/node_modules/ where npm global installs it. From what I understand from the docs, it should just run from the dir I'm in.
from http-server.
OK, now I feel dumb. My mistake was that I was running node http-server
rather than just http-server
. Thanks for that and sorry for the trouble.
from http-server.
Don't sweat it dude!
No problem π½
from http-server.
thx @jonahoffline
from http-server.
I had this problem,too.I solve it. This is my idea.
D:\fs\envs\nodejs2>npm install remix-ide -g
C:\Users\changshoumeng\AppData\Roaming\npm\remix-ide -> C:\Users\changshoumeng\AppData\Roaming\npm\node_modules\remix-ide\bin\remix-ide
- [email protected]
added 1 package in 1.471s
D:\fs\envs\nodejs2>remix-ide
module.js:549
throw err;
^
Error: Cannot find module 'http-server'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\changshoumeng\AppData\Roaming\npm\node_modules\remix-ide\bin\remix-ide:2:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
D:\fs\envs\nodejs2>npm-run http-server
'npm-run' δΈζ―ε
ι¨ζε€ι¨ε½δ»€οΌδΉδΈζ―ε―θΏθ‘ηη¨εΊ
ζζΉε€ηζδ»Άγ
D:\fs\envs\nodejs2>npm install http-server -g
C:\Users\changshoumeng\AppData\Roaming\npm\http-server -> C:\Users\changshoumeng\AppData\Roaming\npm\node_modules\http-server\bin\http-server
C:\Users\changshoumeng\AppData\Roaming\npm\hs -> C:\Users\changshoumeng\AppData\Roaming\npm\node_modules\http-server\bin\http-server
- [email protected]
added 23 packages in 7.816s
D:\fs\envs\nodejs2>remix-ide
Starting Remix IDE at http://localhost:8080
from http-server.
Related Issues (20)
- Static File Directory flag HOT 1
- 404 error on the page with param HOT 2
- index.html change but doesn't have any auto refreshing must to manual refresh HOT 4
- Proxy target request header not present HOT 1
- Bug Report HOT 1
- Do not open a new browser window if one is already open HOT 1
- RangeError: Invalid time value HOT 3
- --cors usage is incorrect in the documentation HOT 1
- How to let the json file (*.json) return response header: 'application/json', instead of 'application/json; charset=UTF-8' HOT 1
- OWASP vulnerability in dependency tree HOT 1
- i use it with termux,but i do not know how to upload file to termux HOT 1
- http-server runing on project root folder path without any reasons HOT 2
- {"message":"You are not authorized"} in GitHub Codespace HOT 2
- Support relative path prefixes (base in vite.config.js) HOT 2
- Need a maintainer? HOT 7
- Link not opening in Browser
- Add bandwidth limit parameter HOT 1
- Option -c is not working
- gz not served HOT 1
- qr code generator in termal HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-server.