Tôi đã may mắn có được một Raspberry Pi dưới gốc cây trong năm nay và tôi đã có một chút thú vị khi chơi với Node.js trên thiết bị. Tuy nhiên, Node.js thú vị hơn nhiều khi bạn có thể kéo các gói xuống và cắm chúng vào các ứng dụng của mình - và đây là lúc tôi gặp một số rắc rối.
Nếu tôi cố cài đặt NPM cùng với Node.js bằng lệnh sau:
sudo apt-get install nodejs npm
Tôi nhận được lỗi sau đây:
pi@raspberrypi ~ $ sudo apt-get install nodejs npm
Reading        package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 nodejs : Breaks: npm (< 1.1.4~dfsg-2~) but 1.1.4~dfsg-1 is to be installed
 npm : Depends: node-semver but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Tôi khá mới mẻ về cách quản lý gói hoạt động với các hệ điều hành Linux dựa trên Debian và không biết nhiều về cách cộng đồng node.js đã cấu trúc các gói cụ thể của chúng. Điều đáng chú ý là bản thân việc cài đặt node.js chỉ hoạt động tốt và nếu tôi cố gắng tự cài đặt NPM thì đây là những gì tôi nhận được.
pi@raspberrypi ~ $ sudo apt-get install npm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 npm : Depends: nodejs but it is not going to be installed
       Depends: nodejs-dev but it is not going to be installed
       Depends: node-request but it is not going to be installed
       Depends: node-mkdirp but it is not going to be installed
       Depends: node-minimatch but it is not going to be installed
       Depends: node-semver but it is not going to be installed
       Depends: node-ini but it is not going to be installed
       Depends: node-graceful-fs but it is not going to be installed
       Depends: node-abbrev but it is not going to be installed
       Depends: node-nopt but it is not going to be installed
       Depends: node-fstream but it is not going to be installed
       Depends: node-rimraf but it is not going to be installed
       Depends: node-tar but it is not going to be installed
       Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Tôi không chắc chắn, nhưng ruột của tôi đang nói với tôi rằng đó là một cái gì đó để làm với node-semvergói. Nếu tôi tự cài đặt nodejsgói và sau đó cố gắng cài đặt node-semverthì đây là đầu ra mà tôi nhận được.
pi@raspberrypi ~ $ sudo apt-get install node-semver
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
 node-semver : Depends: nodejs but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Bất kỳ con trỏ?