Đối với một số lý do sau khi cài đặt nhanh trên toàn cầu trên máy tính của tôi với npm install -g express
nếu tôi cd
vào một thư mục và cố gắng chạy hiện tôi nhận được lỗi sau:nhanh command not found
express: command not found.
Thậm chí nếu tôi chạy nó với sudo
Tôi vẫn nhận được cùng một đầu ra. Tôi đã thử nhiều giải pháp khác nhau cho vấn đề này và không có gì có hiệu quả. Tôi đã cài đặt nút qua homebrew
mà một số chủ đề trên Stack Overflow được chỉ ra có thể là một vấn đề vì vậy tôi đã gỡ cài đặt hoàn toàn nút và cài đặt lại thông qua trình cài đặt trên nodejs.org (hiện tại tôi đang chạy v0.10.26) và vấn đề vẫn tồn tại.
Nếu tôi truy cập vào số /usr/local/lib/node_modules
Express của tôi ở trong đó nhưng trong/usr/local/bin thì không có gì liên quan đến Express. Tôi không chắc chắn nếu đó là một vấn đề hay không nhưng xem xét có nhị phân cho các gói khác được cài đặt trên toàn cầu nút trong thư mục đó tôi nghĩ rằng có thể có cái gì đó sai ở đó.
Đây là sản phẩm chính xác tôi nhận được khi tôi cài đặt:
npm http GET https://registry.npmjs.org/express
npm http 304 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/accepts/1.0.0
npm http GET https://registry.npmjs.org/type-is/1.0.0
npm http GET https://registry.npmjs.org/range-parser/1.0.0
npm http GET https://registry.npmjs.org/cookie/0.1.0
npm http GET https://registry.npmjs.org/fresh/0.2.2
npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1
npm http GET https://registry.npmjs.org/send/0.2.0
npm http GET https://registry.npmjs.org/methods/0.1.0
npm http GET https://registry.npmjs.org/cookie-signature/1.0.3
npm http GET https://registry.npmjs.org/utils-merge/1.0.0
npm http GET https://registry.npmjs.org/merge-descriptors/0.0.2
npm http GET https://registry.npmjs.org/escape-html/1.0.1
npm http GET https://registry.npmjs.org/serve-static/1.0.1
npm http GET https://registry.npmjs.org/qs/0.6.6
npm http GET https://registry.npmjs.org/path-to-regexp/0.1.2
npm http GET https://registry.npmjs.org/parseurl/1.0.1
npm http GET https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/cookie/0.1.0
npm http 304 https://registry.npmjs.org/type-is/1.0.0
npm http 304 https://registry.npmjs.org/buffer-crc32/0.2.1
npm http 304 https://registry.npmjs.org/methods/0.1.0
npm http 304 https://registry.npmjs.org/accepts/1.0.0
npm http 304 https://registry.npmjs.org/range-parser/1.0.0
npm http 304 https://registry.npmjs.org/cookie-signature/1.0.3
npm http 304 https://registry.npmjs.org/fresh/0.2.2
npm http 304 https://registry.npmjs.org/serve-static/1.0.1
npm http 304 https://registry.npmjs.org/qs/0.6.6
npm http 304 https://registry.npmjs.org/utils-merge/1.0.0
npm http 304 https://registry.npmjs.org/merge-descriptors/0.0.2
npm http 304 https://registry.npmjs.org/escape-html/1.0.1
npm http 304 https://registry.npmjs.org/path-to-regexp/0.1.2
npm http 304 https://registry.npmjs.org/parseurl/1.0.1
npm http 304 https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/send/0.2.0
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/send/0.1.4
npm http GET https://registry.npmjs.org/mime
npm http GET https://registry.npmjs.org/negotiator
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/send/0.1.4
npm http GET https://registry.npmjs.org/range-parser/0.0.4
npm http GET https://registry.npmjs.org/fresh/0.2.0
npm http 304 https://registry.npmjs.org/negotiator
npm http 304 https://registry.npmjs.org/range-parser/0.0.4
npm http 304 https://registry.npmjs.org/fresh/0.2.0
[email protected] /usr/local/lib/node_modules/express
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected])
Điều này làm việc cảm ơn rất nhiều vì sự giúp đỡ của bạn! Tôi đã sẵn sàng để kéo tóc của tôi ra trong đêm qua. –
Nó cũng làm việc cho tôi. Cảm ơn bạn! –
bạn đang sống tiết kiệm :) cảm ơn! – nia