Tôi đang sử dụng "npm install" để tải xuống và biên dịch tất cả các phụ thuộc của một ứng dụng node.js nhỏ mà tôi đã viết. Tệp "package.json" mà tôi đang sử dụng là đúng và chứa tất cả thông tin cần thiết."Không thể tìm thấy Python thực thi ..." - npm install treo
Một trong các gói được cài đặt có "nút-gyp" làm phụ thuộc, vì vậy trước đây tôi đã cài đặt gói "python2".
Bây giờ, tại một thời điểm nào đó tôi bắt đầu nhận được thông báo lỗi:
> node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:103:14)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:42:11
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:40:25)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:43:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:54:16
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:99:15)
gyp ERR! System Linux 3.18.9-200.fc21.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /srv/visitor/node_modules/phantom/node_modules/dnode/node_modules/weak
gyp ERR! node -v v0.12.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing [email protected]
Những vấn đề dường như là một biến môi trường là mất tích.
Có ai có thể chỉ cho tôi đúng hướng không? Không có vấn đề mà tôi tìm kiếm trên Internet, không có đề cập đến một biến "PYTHON", chỉ "PYTHONPATH" và những người khác thích nó. Cách chính xác để sửa lỗi này là gì, để tôi không gặp phải lỗi đó?
UPDATE 1:
Sau khi làm theo lời khuyên từ chủ đề này tôi đã thêm các lệnh này trước khi thực hiện "NPM cài đặt":
PYTHON=/usr/sbin/python2
export PYTHON
Bây giờ tôi nhận được lỗi này:
> node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at F (/usr/lib/node_modules/npm/node_modules/which/which.js:40:28)
gyp ERR! stack at E (/usr/lib/node_modules/npm/node_modules/which/which.js:43:29)
gyp ERR! stack at /usr/lib/node_modules/npm/node_modules/which/which.js:54:16
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:99:15)
gyp ERR! System Linux 3.18.9-200.fc21.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /srv/visitor/node_modules/phantom/node_modules/dnode/node_modules/weak
gyp ERR! node -v v0.12.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing [email protected]
Tôi thấy nó vô lý rằng nó nói "... không tìm thấy: làm ...". Có khả năng nào là như vậy không? Nếu có, làm thế nào đến các gói cài đặt chính xác?
Thành thật mà nói, tôi không hiểu một điều gì. Bất kỳ ý tưởng?
Bạn cần đặt biến môi trường 'PYTHON'. Những gì có trong biến đó sẽ được sử dụng. Không quan trọng 'PYTHONPATH' là gì. – adarsh
@adarsh Điều đó tôi có thể nói. Bạn có thể vui lòng xây dựng? Nếu bạn đưa ra câu trả lời, tôi sẽ upvote. – dsljanus
bạn đang sử dụng hệ điều hành nào? làm thế nào bạn cài đặt python2? thử thực hiện nó trong dòng lệnh đầu tiên – irqed